Found compiler bug with __builtin_bit_cast on NVC++ 24.11

Found a compiler bug with NVC++ 24.11 where it is unable to properly figure out the size of the provided array using __builtin_bit_cast unless it has observed the sizes already using sizeof(). This is surprising behavior and does not happen in GCC, Clang, or MSVC. The only other compiler that appears to have this issue is also EDG from my testing. Below I have provided a reproduced example below on godbolt.

Thanks for the report, ianpick98. I’ve filed a problem report, TPR #36840, and have sent it to engineering for investigation.

-Mat

1 Like

FYI, TPR #36840 has been fixed in our 25.1 release.

-Mat

1 Like

Very cool. Out of curiosity, if you are allowed to share, what was causing the strange behavior anyways?

EDG noted that it was an issue where destination type of the __builtin_bit_case construct failed to get initialized resulting in spurious errors about the destination type’s size not matching the operand’s size.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.