[LLVMbugs] [Bug 11742] New: c++11: constant emitter needs to zero-initialize padding for trivially-copyable types

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 10 20:59:38 PST 2012


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

             Bug #: 11742
           Summary: c++11: constant emitter needs to zero-initialize
                    padding for trivially-copyable types
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Padding for objects with static storage duration is currently emitted as undef.
This is non-conforming in C++11, because:

1) zero initialization is performed prior to constant initialization (unlike C)
2) zero initialization initializes padding to 0 bits (unlike C++98)
3) for trivially-copyable types, it is permissible to inspect the effective
array of unsigned char (of size sizeof(T)) comprising the object

Hence a conforming program can tell whether the padding has been
zero-initialized.

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