Skip to content

[Simd] Ignore value-initialization issues in vectorclass.

Value-initialized Vectorclass simd types are not always initialized. The reason is that vectorclass defines default-constructors for its Simd types with empty body and no member initializers. Value-initialization will see those constructors and invoke default-initialization. As the mask types sometimes just contain an unsigned short or similar fundamental data type, default-initializing that does nothing and leaves it inintialized.

To make value-initialization work reliably, vectorclass would need to do one of two things:

  • Make sure the default-constructor is implicitly or explicitly defaulted. That would mean value-initialization would invoke zero-initialization before default-inizialization, which would clear the member
  • Provide a default initializer when declaring the member, which would then be used when the class does not define an initializer for the member in the default-constructor's member-initializer-list.

Since I can't really fix vectorclass, work around this issue by using direct-initialization with an initializer (Simd::Scalar<V>(0)) to initialize simd types.

Closes: extensions/dune-vectorclass#9 (closed)

Edited by Jö Fahlke

Merge request reports