http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-12 
08:29:09 UTC ---
Even smaller:

extern void abort (void);
struct S { int f : 1; } s;
int v = -1;

int
main ()
{
  s.f = v < 0;
  if ((unsigned int) s.f != -1U)
    abort ();
  return 0;
}

I'd say the bug is during expansion of a comparison with signed 1 bit type. 
Then the comparison needs to result 0 / -1 instead of 0 / 1.  I think it would
be difficult to adjust all the conditional expansion to handle this very rare
special case, so probably it will be better to expand such conditionals as
if it was unsigned:1 or unsigned char typed comparison, followed by cast from
that type to signed:1.

Reply via email to