SRA problem with uninitialzed fields

Joseph S. Myers jsm@polyomino.org.uk
Fri Sep 24 19:02:00 GMT 2004


On Fri, 24 Sep 2004, Richard Kenner wrote:

> Well, look at the test case I sent. A mask is clearly required on the
> comparison (at least, I think so!), but the only mechanism to generate it
> is the hook, which is false for C++.

C++ generates the following for this testcase, which includes the mask.  
In accordance with the differences between how the C and C++ standards 
define bit-fields, it doesn't use the reduced-width types.

;; Function int sub1() (_Z4sub1v)

int sub1() ()
{
  struct foo x;

<bb 0>:
  x.f = x.f | 3;
  return (BIT_FIELD_REF <x, 8, 0> & 3) == 3;

}

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list