This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/36449] Incorrect code generated for access to a large struct



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-06-06 13:45 -------
Confirmed.

>From the comparison fold builds BIT_FIELD_REFs and the bit position overflows
32bits.

  bar.foo.a = 0;
  bar.foo.b = 0;
  D.1627 = BIT_FIELD_REF <bar, 32, 0>;
  D.1628 = D.1627 & 4294967295;
  zip.0 = zip;
  D.1630 = BIT_FIELD_REF <*zip.0, 32, ffffffff80000000>;
  D.1631 = D.1630 & 0;
  if (D.1628 == D.1631)

vs. the correct one:

  bar.foo.a = 0;
  bar.foo.b = 0;
  D.1627 = BIT_FIELD_REF <bar, 32, 0>;
  D.1628 = D.1627 & 4294967295;
  zip.0 = zip;
  D.1630 = BIT_FIELD_REF <*zip.0, 32, 2147483584>;
  D.1631 = D.1630 & 4294967295;
  if (D.1628 == D.1631)

Same for 4.2 and 4.3, but fixed on the trunk where I removed this code.

  if ((BIT_FIELD_REF <bar, 32, 0> & 4294967295) == (BIT_FIELD_REF <*zip, 32,
-2147483648> & 0))


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.1.2 4.2.4 4.3.1
      Known to work|                            |4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-06 13:45:07
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]