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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a testcase for the trunk on x86_64-linux-gnu:
```
#define BITFIELD_ENDIAN "big-endian"

#define SRC_ENDIAN "big-endian"
#define DST_ENDIAN "big-endian"

typedef unsigned long long u64;

union DST {
  unsigned long val;

  struct {
    u64 x : 1;
    u64 y : 1;
    u64 r: 62;
  } __attribute__((scalar_storage_order("big-endian")));
} __attribute__((scalar_storage_order("big-endian")));


struct SRC {
  u64 a;
} __attribute__((scalar_storage_order("big-endian")));

[[gnu::noipa]]
void foo (){__builtin_abort();}
[[gnu::noinline]]
int bar(struct SRC *src)
{
  union DST dst;

  dst.val = src->a;

  if (dst.y) {
    foo();
  }
  return 0;
}
int main(void)
{
    struct SRC t = {-1ull & (~(0x01ull<<62))};
    bar(&t);
    return 0;
}
```
It does not cause an abort at -O0 but does at -O2.

Reply via email to