[LLVMbugs] [Bug 7151] New: problem with anonymous union + c99 initializers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 16 15:25:58 PDT 2010


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

           Summary: problem with anonymous union + c99 initializers
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: madcoder at debian.org
                CC: llvmbugs at cs.uiuc.edu


===================== a.i ====================
struct bt_key_range {
    int nkeys;
    struct bt_key_range_rec {
        int      dpos;
        int      dlen;
    } *keys;
    union {
        void     *data;
    };
};

extern void foo(struct bt_key_range *btkr);
void foo(struct bt_key_range *btkr)
{
    *btkr = (struct bt_key_range){
        .keys  = (void *)0L,
        { .data  = (void *)0L },
    };
}
============================================

$  clang -std=c99 -O2 -Wall -Wextra -c a.i -o /dev/null
clang: /home/madcoder/dev/llvm/include/llvm/Instructions.h:276: const
llvm::Type* llvm::checkType(const llvm::Type*): Assertion `Ty && "Invalid
GetElementPtrInst indices for type!"' failed.
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name a.i
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -resource-dir /usr/local/lib/clang/2.0 -O2
-Wall -Wextra -std=c99 -ferror-limit 19 -fmessage-length 119 -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-ia7KTn.s -x cpp-output
a.i 
1.    <eof> parser at end of file
2.    a.i:13:6: LLVM IR generation of declaration 'foo'
3.    a.i:13:6: Generating code for declaration 'foo'
4.    a.i:14:1: LLVM IR generation of compound statement ('{}')
clang: error: compiler command failed due to signal 6 (use -v to see
invocation)

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