Bug 65012 - [5 Regression] systemd fails to build at least on ppc64el, powerpc, arm-inux-gnueabihf and aarch64 with -flto (ICE)
Summary: [5 Regression] systemd fails to build at least on ppc64el, powerpc, arm-inux-...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2015-02-11 03:58 UTC by Matthias Klose
Modified: 2015-02-19 13:30 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-linux-gnu, powerpc64le-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf
Build:
Known to work: 4.9.2
Known to fail: 5.0
Last reconfirmed: 2015-02-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-02-11 03:58:07 UTC
seen with a test rebuild and trunk 20150205,
http://people.ubuntuwire.org/~wgrant/rebuild-ftbfs-test/test-rebuild-20150202-gcc5-vivid.html

no details yet. can other distros confirm?  seems to work on x86 and x86_64.
Comment 1 Matthias Klose 2015-02-11 04:00:19 UTC
/bin/bash ./libtool  --tag=CC   --mode=link gcc -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat
-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclarati
on-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmi
ssing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlen
gth-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wdate-time -Wnested-ex
terns -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-s
ections -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -flto -ffat-lto-objects   -g -O3 -fstack-p
rotector-strong -Wformat -Werror=format-security -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now
 -pie   -Wl,-Bsymbolic-functions -Wl,-z,relro -o test-watchdog src/test/test-watchdog.o libsystemd-shared.la -ldl 
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
Comment 2 Jakub Jelinek 2015-02-17 20:41:35 UTC
So, I've managed to reproduce some crash on aarch64, but whether it is the same one you saw is unclear.
In any case, the backtrace is:
(gdb) p lto_file_data
$3 = (lto_file_decl_data *) 0x0
(gdb) bt
#0  lto_get_decl_name_mapping (decl_data=decl_data@entry=0x0, name=0x3ffaf719e00 "__PRETTY_FUNCTION__.9700") at ../../gcc/lto-section-in.c:369
#1  0x0000000000ad3f90 in varpool_node::get_constructor (this=0x3ffaf8ea800) at ../../gcc/varpool.c:315
#2  0x0000000000acca64 in get_variable_section (decl=decl@entry=0x3ffaf6c1e60, prefer_noswitch_p=prefer_noswitch_p@entry=true)
    at ../../gcc/varasm.c:1143
#3  0x0000000000acd8f0 in get_block_for_decl (decl=decl@entry=0x3ffaf6c1e60) at ../../gcc/varasm.c:1216
#4  0x0000000000acf168 in make_decl_rtl (decl=decl@entry=0x3ffaf6c1e60) at ../../gcc/varasm.c:1471
#5  0x0000000000acf788 in make_decl_rtl_for_debug (decl=decl@entry=0x3ffaf6c1e60) at ../../gcc/varasm.c:1519
#6  0x0000000000625b5c in rtl_for_decl_location (decl=decl@entry=0x3ffaf6c1e60) at ../../gcc/dwarf2out.c:15950
#7  0x000000000064b518 in loc_list_from_tree (loc=loc@entry=0x3ffaf6c1e60, want_address=2, context=context@entry=0x0)
    at ../../gcc/dwarf2out.c:14579
#8  0x000000000064e450 in add_location_or_const_value_attribute(dw_die_ref, tree, bool, enum dwarf_attribute) (die=0x3ffaf9b69f0, 
    decl=0x3ffaf6c1e60, cache_p=cache_p@entry=false, attr=DW_AT_location) at ../../gcc/dwarf2out.c:16083
#9  0x00000000006562a0 in dwarf2out_finish (filename=0x109d2d0 <targetm> "(\362", <incomplete sequence \361>) at ../../gcc/dwarf2out.c:24554
#10 0x00000000008c7968 in compile_file () at ../../gcc/toplev.c:650
#11 0x0000000000564ee8 in do_compile () at ../../gcc/toplev.c:2066
#12 toplev::main (this=0x0, this@entry=0x3fffffff080, argc=-1295660700, argc@entry=52, argv=
    0xd80101 <std::__cxx11::messages<char>::do_get(int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const+17>, argv@entry=0x3fffffff1b8) at ../../gcc/toplev.c:2164
#13 0x00000000005657f4 in main (argc=52, argv=0x3fffffff1b8) at ../../gcc/main.c:39

I.e. dwarf2out trying to compute RTL for a __PRETTY_FUNCTION__ VAR_DECL, but has NULL lto_file_data.  The VAR_DECL is streamed in from LTO,
but without corresponding varpool node.  That node is added only during the make_decl_rtl_for_debug call, so obviously it has NULL lto_file_data member and varpool_node::get_constructor ICEs on it,
because it assumes it must be non-NULL.

So, either we change varpool_node::get_constructor, so that it treats !lto_file_data the same as !in_lto_p.
Or tweak make_decl_rtl_for_debug to temporarily clear in_lto_p flag and restore afterwards.
Or add another global flag which would tell us that we are called from make_decl_rtl_for_debug and be more permissive in that case (i.e. bail out for NULL lto_file_data).

Honza, your preference?
Comment 3 Jakub Jelinek 2015-02-19 11:56:32 UTC
Author: jakub
Date: Thu Feb 19 11:56:00 2015
New Revision: 220810

URL: https://gcc.gnu.org/viewcvs?rev=220810&root=gcc&view=rev
Log:
	PR lto/65012
	* varpool.c (varpool_node::get_constructor): Return early
	if this->lto_file_data is NULL.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/varpool.c
Comment 4 Jakub Jelinek 2015-02-19 13:30:20 UTC
Fixed.