#include <stdio.h>
void __attribute__ ((__noinline__))
add14(unsigned short int nextID)
{
  struct {
    unsigned short int id: 14;
  } hdr;
  hdr.id = nextID;
  do {
    hdr.id++;
    if (printf ("should print 0x0000: 0x%04X\n", (unsigned int)hdr.id))
      break;
  } while (1);
}
main()
{
  add14 (0x3FFF);
  return 0;
}

G++ miscompiles with optimization.  GCC compiles correctly.  Regression from
3.3.


-- 
           Summary: illegal loop store motion of bitfield
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stuart at apple dot com
 GCC build triplet: i386-apple-darwin9
  GCC host triplet: i386-apple-darwin9
GCC target triplet: i386-apple-darwin9


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

Reply via email to