[LLVMbugs] [Bug 10648] New: Flexible array members not initialized properly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 12 12:55:52 PDT 2011


           Summary: Flexible array members not initialized properly
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: darkrain654 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=7065)
 --> (http://llvm.org/bugs/attachment.cgi?id=7065)
An example of the bug

A flexible array member in a struct is only initialized when static or const.
The attached example prints garbage when used with an automatic struct or any
compound literal or pointer to compound literal, whether the struct is used in
the same function or a pointer to it is passed to another function. The
assembly code shows the data for the two structs that print correctly, but
strangely also has struct "vec2" with the right values even though it's still
uninitialized when running the program. The values of the other structs don't
appear in the assembly code at all and it looks like it's just copying random
junk off the stack.

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