LTO problems with -fprofile-generate (aarch64)

Benedikt Huber benedikt.huber@theobroma-systems.com
Wed Feb 25 17:27:00 GMT 2015


Compiling with -flto-partition=none succeeds,
however increases compilation time significantly.

One interesting thing is that even the failed compile
produces an executable that works. Is that normal?

Should I really attach the ipa-cgraph dump to the bug report?
The file is 945M big, 27M compressed. 
I could preprocess it to extract only the important data,
if you can tell me how.

Removing the assertion causes a segmentation fault.
I assume that this is not a good solution.

lto1: internal compiler error: Segmentation fault
0x8a865f crash_signal
        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/../src/gcc/gcc/toplev.c:383
0x721394 symbol_table::remove_unreachable_nodes(_IO_FILE*)
        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/../src/gcc/gcc/ipa.c:419
0x47e0c0 read_cgraph_and_symbols
        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/../src/gcc/gcc/lto/lto.c:3118
0x47e0c0 lto_main()
        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/../src/gcc/gcc/lto/lto.c:3441
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
make: *** [/tmp/ccIQbPRz.ltrans7.ltrans.o] Error 1
make: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.

On 25 Feb 2015, at 11:42, Jan Hubicka <hubicka@ucw.cz> wrote:

>> Hi,
>> 
>> I have problems compiling xalan as part of spec2006 benchmark for aarch64, both native and cross.
>> The issue arises when both -flto and -fprofile-generate are enabled during LTO.
>> Compiling with the same flags for x86 has no problem.
>> Also other projects for aarch64 compile with -flto and -fprofile-generate without problem.
>> 
>> lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:210
>> 
>> 204   /* Ensure that SAME_COMDAT_GROUP lists all allways added in a group.  */
>> 205   if (node->same_comdat_group)
>> 206     for (node1 = node->same_comdat_group;
>> 207          node1 != node; node1 = node1->same_comdat_group)
>> 208       if (!node->alias)
>> 209         {
>> 210           bool added = add_symbol_to_partition_1 (part, node1);
>> 211           gcc_assert (added);
>> 212         }
>> 213   return true;
>> 214 }
>> 
>> Is this a known issue? How can I debug this? Do I need additional options?
>> Any hints?
> 
> I am not aware of similar PR.  Can you please just fill in an PR and attach dumps of 
> -fdump-ipa-cgraph
> I think the bug is quite obivous - the function recurses to add_symbol_to_partition_1
> and if you have more than 2 symbols in a group it needs to ICE, but I would like to double
> check it is indeed the case.
> 
> You can just rmeove the assert to see if it lets things to compile well.
> 
> Honza
>> 
>> 
>> I get this error:
>> 
>> lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:210
>> 0x484349 add_symbol_to_partition_1
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:210
>> 0x48442d add_symbol_to_partition_1
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:182
>> 0x48442d add_symbol_to_partition_1
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:182
>> 0x48442d add_symbol_to_partition_1
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:182
>> 0x484403 add_symbol_to_partition_1
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:180
>> 0x4854a1 lto_balanced_map(int)
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto-partition.c:549
>> 0x47e277 do_whole_program_analysis
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto.c:3297
>> 0x47e277 lto_main()
>>        /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot/../src/gcc/gcc/lto/lto.c:3451
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> Please include the complete backtrace with any bug report.
>> See  for instructions.
>> lto-wrapper: fatal error: /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/upstream-le/install/opt/for-aarch64/upstream-le/bin/aarch64-for-linux-gnu-g++ returned 1 exit status
>> compilation terminated.
>> collect2: fatal error: lto-wrapper returned 1 exit status
>> compilation terminated.
>> 
>> 
>> I am using a very recent 5.0 based gcc:
>> 
>> commit e0eaf9732ae973d6204928da23a954683dcfe304
>> Author: edlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
>> Date:   Sun Feb 22 19:38:53 2015 +0000
>> 
>>    2015-02-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
>> 
>>            PR fortran/64980
>>            PR fortran/61960
>>            * trans-expr.c (gfc_apply_interface_mapping_to_expr): Remove mapping
>>            for component references to class objects.
>>            (gfc_conv_procedure_call): Compare the class by name.
>> 
>>    testsuite:
>>    2015-02-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
>> 
>>            PR fortran/64980
>>            PR fortran/61960
>>            * gfortran.dg/pr61960.f90: New.
>>            * gfortran.dg/pr64230.f90: New.
>>            * gfortran.dg/pr64980.f03: New.
>> 
>> 
>>    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220899 138bc75d-0d04-0410-961f-82ee72b054a4
>> 
>> 
>> Compilation command is (same for all *.cpp):
>> 
>> /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/upstream-le/install/opt/for-aarch64/upstream-le/bin/aarch64-for-linux-gnu-g++
>> -c -O3 -flto=8
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc/dom
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc/dom/impl
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc/sax
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc/util/MsgLoaders/InMemory
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xercesc/util/Transcoders/Iconv
>> -I/home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/xalanc/include
>> -DSPEC_CPU_LP64 -DSPEC_CPU_LINUX -DNDEBUG -DSPEC_CPU -DAPP_NO_THREADS
>> -DXALAN_INMEM_MSG_LOADER -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS
>> -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_VALIDATORS
>> -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -fno-vect-cost-model
>> -lpthread -funroll-all-loops - finline-limit=1000 --param
>> max-inline-insns-single=2000 --param max-inline-insns-auto=2000 --param
>> large-unit-insns=30000 --param inline-unit-growth=400 --param
>> ipcp-unit-growth=100 --param early-inlining-insns=200 -fprofile-generate -ffast-math -Wall -Wextra
>> /home/bhuber/sandbox/spec/cpu2006/benchspec/CPU2006/483.xalancbmk/src/YearMonthDatatypeValidator.cpp
>> 
>> 
>> Linker command:
>> 
>> /home/bhuber/sandbox/gcc/toolchain-build-scripts/buildroot-upstream/upstream-le/install/opt/for-aarch64/upstream-le/bin/aarch64-for-linux-gnu-g++
>> -o /home/bhuber/sandbox/try/out/my_executable -O3 -flto=8 -DSPEC_CPU_LP64
>> -DSPEC_CPU_LINUX -DNDEBUG -DSPEC_CPU -DAPP_NO_THREADS -DXALAN_INMEM_MSG_LOADER
>> -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2
>> -DPROJ_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER
>> -DXML_USE_INMEM_MESSAGELOADER -fno-vect-cost-model -lpthread -funroll-all-loops
>> -finline-limit=1000 --param max-inline-insns-single=2000 --param
>> max-inline-insns-auto=2000 --param large-unit-insns=30000 --param
>> inline-unit-growth=400 --param ipcp-unit-growth=100 -param
>> early-inlining-insns=200 -fprofile-generate -ffast-math
>> /home/bhuber/sandbox/try/out/*.o -lm
>> 
>> Thank you and best regards,
>> Benedikt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20150225/3cda45f9/attachment.sig>


More information about the Gcc mailing list