[LLVMbugs] [Bug 6437] New: Assertion when casting 'struct in_addr const' to 'uint32_t&'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 26 11:06:32 PST 2010


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

           Summary: Assertion when casting 'struct in_addr const' to
                    'uint32_t&'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: brian at cowe.org
                CC: llvmbugs at cs.uiuc.edu


Compiling this source file generates an assertion in clang.  I would expect a
useful warning / error message to be shown, or the code to compile if it's
valid -- but not the compiler to crash.

Trunk, change 97225.  Full compilation command line and results included below.


===== BEGIN SOURCE foo.cpp =====
#include <netinet/in.h>

uint32_t
copy( const struct sockaddr_in &new_addr ) {
   uint32_t addr = (uint32_t&)new_addr.sin_addr;
   return( addr );
}
===== END SOURCE foo.cpp =====


bcowe$ /space/bcowe/llvm-2.7-inprogress/Release/bin/clang -c -v foo.cpp 
clang version 1.1 (trunk 97225)
Target: x86_64-unknown-linux-gnu
Thread model: posix
 "/space/bcowe/llvm-2.7-inprogress/Release/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name foo.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -v -resource-dir
/space/bcowe/llvm-2.7-inprogress/Release/lib/clang/1.1 -fmessage-length 209
-fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-OL4RBh.s -x c++ foo.cpp
clang -cc1 version 1.1 based upon llvm 2.7svn hosted on
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/include/c++/4.4.3"
ignoring nonexistent directory "/usr/include/c++/4.4.3/x86_64-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.3"
ignoring nonexistent directory "/usr/include/c++/4.4.3/i686-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.2"
ignoring nonexistent directory "/usr/include/c++/4.4.2/x86_64-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.1.3"
ignoring nonexistent directory "/usr/include/c++/4.1.3/i486-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.1.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.3"
ignoring nonexistent directory "/usr/include/c++/4.3.3/x86_64-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.1.2"
ignoring nonexistent directory "/usr/include/c++/4.1.2/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.1.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.0"
ignoring nonexistent directory "/usr/include/c++/4.3.0/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.0/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.2"
ignoring nonexistent directory "/usr/include/c++/4.3.2/i386-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.2"
ignoring nonexistent directory "/usr/include/c++/4.3.2/x86_64-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.1/i586-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.2"
ignoring nonexistent directory "/usr/include/c++/4.4.2/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.2/backward"
ignoring nonexistent directory "/usr/include/c++/4.4.3"
ignoring nonexistent directory "/usr/include/c++/4.4.3/i686-redhat-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4.3/backward"
ignoring nonexistent directory "/usr/include/c++/4.3/i586-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3/x86_64-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4/i586-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.4/x86_64-suse-linux/"
ignoring nonexistent directory "/usr/include/c++/4.3.1"
ignoring nonexistent directory "/usr/include/c++/4.3.1/i686-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3.1/backward"
ignoring nonexistent directory "/usr/include/c++/4.3.1"
ignoring nonexistent directory
"/usr/include/c++/4.3.1/x86_64-unknown-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3.1/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4/backward"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/backward"
ignoring nonexistent directory "/usr/include/c++/4.3/i486-pc-linux-gnu/"
ignoring nonexistent directory "/usr/include/c++/4.3/i486-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4/backward"
ignoring duplicate directory "/usr/include/c++/4.4.1"
ignoring duplicate directory "/usr/include/c++/4.4.1/backward"
ignoring duplicate directory "/usr/include/c++/4.3"
ignoring duplicate directory "/usr/include/c++/4.3/backward"
ignoring duplicate directory "/usr/include/c++/4.4.1"
ignoring duplicate directory "/usr/include/c++/4.4.1/backward"
ignoring duplicate directory "/usr/include/c++/4.4.1"
ignoring duplicate directory "/usr/include/c++/4.4.1/backward"
ignoring duplicate directory "/usr/include/c++/4.3"
ignoring duplicate directory "/usr/include/c++/4.3/backward"
ignoring duplicate directory "/usr/include/c++/4.3"
ignoring duplicate directory "/usr/include/c++/4.3/backward"
#include "..." search starts here:
#include <...> search starts here:
 /space/bcowe/llvm-2.7-inprogress/Release/lib/clang/1.1/include
 /usr/include/c++/4.4.1
 /usr/include/c++/4.4.1/x86_64-linux-gnu
 /usr/include/c++/4.4.1/backward
 /usr/include/c++/4.3
 /usr/include/c++/4.3/backward
 /usr/local/include
 /usr/include
End of search list.
clang: CGExpr.cpp:579: clang::CodeGen::RValue
clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue,
clang::QualType): Assertion `ExprType->isFunctionType() && "Unknown scalar
value"' failed.
0  clang           0x0000000001469bff
1  clang           0x000000000146a3ed
2  libpthread.so.0 0x00007feb1cfed190
3  libc.so.6       0x00007feb1c2f34b5 gsignal + 53
4  libc.so.6       0x00007feb1c2f6f50 abort + 384
5  libc.so.6       0x00007feb1c2ec481 __assert_fail + 241
6  clang           0x000000000055b3dd
7  clang           0x00000000005810b7
8  clang           0x00000000005841f3
9  clang           0x0000000000580f52
10 clang           0x00000000005813d7
11 clang           0x000000000054f336
12 clang           0x000000000054ffd2
13 clang           0x00000000005bedb8
14 clang           0x00000000005c461e
15 clang           0x00000000005c207c
16 clang           0x00000000005c4380
17 clang           0x00000000005c4667
18 clang           0x00000000005c207c
19 clang           0x00000000005e6380
20 clang           0x000000000050bff4
21 clang           0x000000000050d3c4
22 clang           0x000000000050d5f4
23 clang           0x000000000050d914
24 clang           0x0000000000505661
25 clang           0x00000000004115e4
26 clang           0x00000000005f6482
27 clang           0x0000000000416bf9
28 clang           0x00000000004095ce
29 clang           0x000000000040c36b main + 1771
30 libc.so.6       0x00007feb1c2deabd __libc_start_main + 253
31 clang           0x0000000000407149
Stack dump:
0.    Program arguments: /space/bcowe/llvm-2.7-inprogress/Release/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name foo.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -v -resource-dir
/space/bcowe/llvm-2.7-inprogress/Release/lib/clang/1.1 -fmessage-length 209
-fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-OL4RBh.s -x c++ foo.cpp 
1.    <eof> parser at end of file
2.    foo.cpp:4:1: LLVM IR generation of declaration 'copy'
3.    foo.cpp:4:1: Generating code for declaration 'copy'
4.    foo.cpp:4:44: LLVM IR generation of compound statement ('{}')
clang: error: compiler command failed due to signal 6 (use -v to see
invocation)
bcowe$

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