SRA problem with uninitialzed fields

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


On Fri, 24 Sep 2004, Richard Kenner wrote:

> But what about the C test case I sent?  Isn't that valid C++ also and
> wouldn't it have the problem I mentioned if that hook is false?

C++ bit-fields have a restricted width representation but their type is 
the underlying type rather than a special restricted width type.  (Thus 
e.g. with 64-bit long, 32-bit int, unsigned long:40 + unsigned long:40 has 
type unsigned long:40 in C but type unsigned long in C++.)  A proper 
implementation that keeps the types those that accord with the language 
semantics would be for the GIMPLE generated to include explicit mask 
operations for assignments to bit-fields.  If it doesn't represent that 
assignment to a bit-field from the same type may change the value, then 
there are likely to be problems.  At one point there were, but I don't see 
such problems at present in some quick tests.

-- 
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