Skip to content

Conversation

@bader
Copy link
Contributor

@bader bader commented Dec 18, 2025

sycl::marray default constructor check has undefined behavior.
marray is default-initialized, which means that elements of marray is
also default-initialized. For element data type like int
default-initialized value with automatic storage produces indeterminate
value. The check compares marray elements with value-initialized object
(i.e. with 0 for int data type). Using indetermiate values in
compare operation causes undefined behavior.

The issue is exposed by recent change in DPC++ implementation, which
switched marray elements initialization in default constructor from
value-initialization to default-initialization.
intel/llvm@ba4f090

See
https://en.cppreference.com/w/cpp/language/default_initialization.html
for more details.

sycl::marray default constructor check has undefined behavior.
marray is default-initialized, which means that elements of marray is
also default-initialized. For element data type like `int`
default-initialized value with automatic storage produces indeterminate
value. The check compares marray elements with value-initialized object
(i.e. with `0` for `int` data type). Using indetermiate values in
compare operation causes undefined behavior.

The issue is exposed by recent change in DPC++ implementation, which
switched marray elements initialization in default constructor from
value-initialization to default-initialization.
intel/llvm@ba4f090

See
https://en.cppreference.com/w/cpp/language/default_initialization.html
for more details.
@bader bader requested a review from a team as a code owner December 18, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant