> Internally, we use VIEW_CONVERT_EXPR to overlay a TImode
> container on top of a struct.  There is no exact C
> equivalent, though a union comes close.  I tried that,
> but couldn't replicate the exact set of events that have
> to be present to hit the problem. I send what I tried
> to you separately.

OK, the problem is that TImode is not available as "automatic" mode on the 
x86-64 so you'd need to be on IA-64, Alpha or s390x for example to reproduce 
in C; moreover you need to be on little-endian with good 32-bit support so 
only IA-64 remains.  But the use of predicate registers on IA-64 apparently 
hides the problem...

It turns out that x86 is a perfect fit if you cut all the types in half.
The attached testcase aborts at -O -fgcse with every 4.x compiler (you 
need -fno-split-wide-types for 4.3.x and later though) because of the wrong 
REG_EQUAL note.  It's even a regression since this doesn't happen with 3.4.x.

-- 
Eric Botcazou
extern void abort(void);

typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;

typedef struct
{
  uint16_t thread;
  uint16_t phase;
} s32;

typedef union
{
  uint32_t i;
  s32 s;
} u32;

typedef union
{
  uint64_t i;
  u32 u;
} u64;

static __attribute__((noinline))
void foo(int val)
{
  u64 data;
  uint32_t thread;

  data.u.i = 0x10000L;
  thread = data.u.s.thread;
  if (val)
    abort ();
  if (thread)
    abort();
}

int main(void)
{
  foo (0);
  return 0;
}

Reply via email to