[LLVMbugs] [Bug 8413] New: Crash in generated code with aligned structs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 18 16:47:59 PDT 2010


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

           Summary: Crash in generated code with aligned structs
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: arsenm2 at rpi.edu
                CC: llvmbugs at cs.uiuc.edu


This is a problem where clang generates code which crashes. The simplest case
seems to happen when trying to use a vector type or aligned struct in a struct
with the aligned and packed attributes, where the first item in the struct is
smaller than the aligned struct. On assignment to the vector field,     the
program crashes with gdb reporting it as "Program received signal
EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address:
0x0000000000000000"

The reduced test case crash occurs when building WITHOUT optimizations (i.e.
-O0), but doesn't with higher levels (-O1, -O2, or -O3). However, in the larger
program I was working with when I encountered the problem, it was broken with
and without optimizations. Both the test case and the program I was working on
worked fine with gcc and llvm-gcc.

Both lldb and gdb are terribly confused in functions where this problem occurs,
reporting wrong values for the arguments passed in which don't agree with
values printed out.

Attached is a small test case. It consists of 4 variants on the same concept,
with some more notes about what I've found about the problem. With any of the
special vector extension types, or the struct with the aligned attribute, clang
generates code which crashes when assigning to that field within the larger
struct. Tested on x86_64 Linux and OS X, clang 2.8, and gcc-4.5, and (GCC)
4.2.1 (Apple Inc. build 5664).

Build / run it with:  

$ clang -O0 aligned_struct_clang_bug.c && ./a.out

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