don't warn about uninitialized anonymous bitfields

Alexandre Oliva
Wed Mar 7 08:32:00 GMT 2007

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: <>
-------------- next part --------------

Alexandre Oliva
FSF Latin America Board Member
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

More information about the Gcc-patches mailing list