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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to