[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c++/114536] wrong constant evaluation of std::bit_cast for bit fields
From:       "pinskia at gcc dot gnu.org via Gcc-bugs" <gcc-bugs () gcc ! gnu ! org>
Date:       2024-03-31 19:28:32
Message-ID: bug-114536-4-srQNlC8hsK () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114536

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-31
     Ever confirmed|0                           |1

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note you can't compare against clang though:
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.1/../../../../include/c++/14.0.1/bit:94:14:
                
note: constexpr bit_cast involving bit-field is not yet supported


But anyways with the padding bit.

With signed char instead of unsigned char, GCC gives:
```
/opt/compiler-explorer/gcc-trunk-20240331/include/c++/14.0.1/bit:94:33: error:
'__builtin_bit_cast' accessing uninitialized byte at offset 0

```

That is correct for that but in the case of unsigned char (or std::byte).=


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic