[LLVMbugs] [Bug 14352] New: -Wuninitialized on partially uninitialized value in union

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 15 03:27:59 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14352

             Bug #: 14352
           Summary: -Wuninitialized on partially uninitialized value in
                    union
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I was recently bitten by this code:

  float f();

  int foo() {
    union {
      float a;
      int b;
    } x = { f() };
    return x.b;
  }

On a 64-bit system, the int is 64-bits and the float is 32-bits, there's no
zero-initialization of the padding, and so 'x.b' has the top-half uninitialized
bits and the bottom-half initialized. I would like a -Wuninitialized warning on
this.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list