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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |rguenth at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
struct atomic {
 unsigned long my_value;
public:
 atomic() = default ;
 atomic(unsigned long value) : my_value(value) {}
 unsigned long load() {
     int32_t* v = reinterpret_cast<int32_t*>(&my_value);
     return (volatile int32_t&)(*v);
 }

you are initializing my_value as long but read from it as int32_t, that
violates strict-aliasing rules.

Reply via email to