[LLVMbugs] [Bug 7150] New: transparent_unions makes clang ICE

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 16 15:05:54 PDT 2010


           Summary: transparent_unions makes clang ICE
           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

clang sometimes ICEs with transparent unions for code that compiles fine with

$ gcc -O2 -Wall -Wextra -c a.i -o /dev/null

$ clang -O2 -Wall -Wextra -c a.i -o /dev/null
clang: /home/madcoder/dev/llvm/lib/VMCore/Instructions.cpp:1046: void
llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() ==
cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a
pointer to Val 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 -ferror-limit 19 -fmessage-length 239 -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-IwZQDv.s -x cpp-output
1.    <eof> parser at end of file
2.    a.i:11:6: LLVM IR generation of declaration 'bar'
3.    a.i:11:6: Generating code for declaration 'bar'
4.    a.i:12:1: LLVM IR generation of compound statement ('{}')
clang: error: compiler command failed due to signal 6 (use -v to see

===================== a.i content ===================
typedef union tu_t {
    unsigned long long u64;
    void *ptr;
} tu_t __attribute__((transparent_union));

typedef struct some_type_t some_type_t;

extern void foo(tu_t);
extern void bar(some_type_t *ic);

void bar(some_type_t *ic)


For what it's worth, foo((void *)ic) compiles fine.

For one, as in C any point casts implicitely to void *, the some_type_t *
should find its way through the "ptr" member of the transparent union, second
even if that's not supported yet, it should not make clang abort :)

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