don't warn about uninitialized anonymous bitfields

Alexandre Oliva aoliva@redhat.com
Wed Mar 7 08:32:00 GMT 2007


https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=229459

When compiling code such as:

// gcc -O2 -Wall -S uninit-anon-bitfield.c

struct foo {
  unsigned int a:16;
  unsigned int b:11;
  unsigned int :5;
};

extern struct foo bar;

void foo(int a, int b)
{
  struct foo tmp;

  tmp.a = a;
  tmp.b = b;

  bar = tmp;
}

GCC scalarizes tmp and then issues a warning about the use of the
uninitialized annoymous bitfield.

This patch silences the warning.  Bootstrapped and regtested on
x86_64-linux-gnu.   Ok to install?

:ADDPATCH tree-sra:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-sra-nowarn-anon-bitfld.patch
Type: text/x-patch
Size: 2698 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070307/e0363eb0/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


More information about the Gcc-patches mailing list