http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54702
Bug #: 54702 Summary: lto1: internal compiler error: verify_cgraph_node failed Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: dim...@gmail.com gcc version 4.8.0 20120925 (experimental) [trunk revision 191688] (GCC) $ gcc -O2 -flto -m64 -c X.i -o x.o X.i: In function 'f1': X.i:12:9: warning: incompatible implicit declaration of built-in function 'malloc' [enabled by default] b = malloc (0); ^ $ gcc -O2 -flto -m64 -c f.c -o f.o $ ar cru x.a x.o $ ar cru f.a f.o $ cat f.c #include <stdlib.h> void* f () { void* p = malloc (1); return p; } $ cat X.i int *b; void *d; int c; static int *f1 (); void f2 () { int *a = f1 (0); } int *f1 (j) { b = malloc (0); d = *malloc; c = j; } $ gcc -shared -Wl,--whole-archive f.a x.a -Wl,--no-whole-archive -O2 -flto -m64 -Wl,--dynamic-linker=/lib64/ld-lsb-x86-64.so.3 -o libx.so lto1: error: edge points to wrong declaration: <function_decl 0x7faf7724ff00 malloc type <function_type 0x7faf772507e0 type <pointer_type 0x7faf77124c78 type <void_type 0x7faf77124bd0 void> public unsigned DI size <integer_cst 0x7faf77113d20 constant 64> unit size <integer_cst 0x7faf77113d40 constant 8> align 64 symtab 0 alias set -1 canonical type 0x7faf77124c78 pointer_to_this <pointer_type 0x7faf77250c78>> QI size <integer_cst 0x7faf77113ee0 constant 8> unit size <integer_cst 0x7faf77113f00 constant 1> align 8 symtab 0 alias set -1 canonical type 0x7faf772507e0 arg-types <tree_list 0x7faf7724c938 value <integer_type 0x7faf77250888 size_t> chain <tree_list 0x7faf7711e6e0 value <void_type 0x7faf77124bd0 void>>> pointer_to_this <pointer_type 0x7faf77250d20>> addressable used nothrow public external built-in QI file /usr/include/stdlib.h line 471 col 14 align 8 built-in BUILT_IN_NORMAL:BUILT_IN_MALLOC context <translation_unit_decl 0x7faf77253000 D.2374> attributes <tree_list 0x7faf7724c988>> Instead of: <function_decl 0x7faf771a7700 __builtin_malloc type <function_type 0x7faf77134498 type <pointer_type 0x7faf77124c78 type <void_type 0x7faf77124bd0 void> public unsigned DI size <integer_cst 0x7faf77113d20 constant 64> unit size <integer_cst 0x7faf77113d40 constant 8> align 64 symtab 0 alias set -1 canonical type 0x7faf77124c78 pointer_to_this <pointer_type 0x7faf77250c78>> QI size <integer_cst 0x7faf77113ee0 constant 8> unit size <integer_cst 0x7faf77113f00 constant 1> align 8 symtab 0 alias set -1 canonical type 0x7faf77134498 arg-types <tree_list 0x7faf7711e988 value <integer_type 0x7faf771247e0 long unsigned int> chain <tree_list 0x7faf7711e6e0 value <void_type 0x7faf77124bd0 void>>>> addressable nothrow public external built-in QI file <built-in> line 0 col 0 align 8 built-in BUILT_IN_NORMAL:BUILT_IN_MALLOC attributes <tree_list 0x7faf771a6fa0>> f1.2370.constprop.0.2371/19 (f1.2370.constprop.0) @0x7faf7711c9c0 Type: function Visibility: artificial References: b/9 (write)d/10 (write)malloc/25 (addr)c/11 (write) Referring: Read from file: /tmp/ccHBWK8F.ltrans0.o Function f1.2370.constprop.0/19 is inline copy in f2/12 Availability: local Function flags: analyzed body local finalized Called by: f2/12 (1.00 per call) (inlined) Calls: malloc/8 (1.00 per call) lto1: internal compiler error: verify_cgraph_node failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: gcc returned 1 exit status /usr/bin/ld: fatal error: lto-wrapper failed collect2: error: ld returned 1 exit status $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/dimhen/src/gcc-current/configure --prefix=/usr/local/gcc_current --with-multilib-list=m64 --enable-__cxa_atexit --enable-shared --enable-checking=df,fold,rtl,tree,yes --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,lto --enable-plugin --enable-version-specific-runtime-libs Thread model: posix gcc version 4.8.0 20120925 (experimental) [trunk revision 191688] (GCC)