Bug 47478 - [4.4 Regression] internal compiler error
Summary: [4.4 Regression] internal compiler error
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.4.5
: P3 normal
Target Milestone: 4.5.2
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2011-01-26 17:28 UTC by Andrew Leaver-Fay
Modified: 2014-02-16 13:17 UTC (History)
3 users (show)

See Also:
Known to work: 4.5.2, 4.6.0
Known to fail: 4.4.5
Last reconfirmed: 2011-01-26 19:13:11

-save-temps file (.ii) that produces this crash (too big to upload without bzipping it -- sorry!) (274.74 KB, application/x-bzip)
2011-01-26 17:30 UTC, Andrew Leaver-Fay

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Leaver-Fay 2011-01-26 17:28:44 UTC
This file compiles just fine with earlier versions of G++.  The compiler error appears at the end of a function which is the last function in the file.

$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) 


Command line:

$ g++ -save-temps -o build/src/release/linux/2.6/64/x86/gcc/protocols/loophash/LoopHashMap.os -c -std=c++98 -pipe -ffor-scope -W -Wall -pedantic -Wno-long-long -O3 -ffast-math -funroll-loops -finline-functions -finline-limit=20000 -s -Wno-unused-variable -fPIC -DNDEBUG -Isrc -Iexternal/include -Isrc/platform/linux/64/gcc -Isrc/platform/linux/64 -Isrc/platform/linux -Iexternal/boost_1_38_0 -I/usr/local/include -I/usr/include src/protocols/loophash/LoopHashMap.cc 
g++: warning: -pipe ignored because -save-temps specified
In file included from src/protocols/loophash/LoopHashMap.cc:18:
src/protocols/loophash/LoopHashMap.hh:120: warning: type qualifiers ignored on function return type
src/protocols/loophash/LoopHashMap.cc:360: warning: type qualifiers ignored on function return type
In file included from external/boost_1_38_0/boost/unordered_map.hpp:17,
                 from src/protocols/loophash/LoopHashMap.hh:22,
                 from src/protocols/loophash/LoopHashMap.cc:18:
external/boost_1_38_0/boost/unordered/detail/hash_table_impl.hpp: In member function ‘typename boost::unordered_detail::hash_types_equivalent_keys<std::pair<const Key, T>, Key, Hash, Pred, Alloc>::iterator boost::unordered_multimap<Key, T, Hash, Pred, Alloc>::insert(const std::pair<const Key, T>&) [with Key = long unsigned int, T = long unsigned int, Hash = protocols::match::bin_index_hasher, Pred = std::equal_to<long unsigned int>, Alloc = std::allocator<std::pair<const long unsigned int, long unsigned int> >]’:
external/boost_1_38_0/boost/unordered/detail/hash_table_impl.hpp:101: warning: ‘<anonymous>’ may be used uninitialized in this function
external/boost_1_38_0/boost/unordered/detail/hash_table_impl.hpp:210: note: ‘<anonymous>’ was declared here
src/protocols/loophash/LoopHashMap.cc: In member function ‘void protocols::loophash::LoopHashMap::read_db(std::string, std::pair<long unsigned int, long unsigned int>, std::map<long unsigned int, bool, std::less<long unsigned int>, std::allocator<std::pair<const long unsigned int, bool> > >&)’:
src/protocols/loophash/LoopHashMap.cc:436: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
Comment 1 Andrew Leaver-Fay 2011-01-26 17:30:58 UTC
Created attachment 23135 [details]
-save-temps file (.ii) that produces this crash (too big to upload without bzipping it -- sorry!)
Comment 2 Andrew Leaver-Fay 2011-01-26 18:21:36 UTC
I'd love a suggestion on how the code could be changed so that I no longer get this segfault.
Comment 3 Jonathan Wakely 2011-01-26 19:13:11 UTC

for 4.4.3 I get an ICE with
g++ LoopHashMap.ii   -O2  -funroll-loops -finline-functions -finline-limit=488
but not with
g++ LoopHashMap.ii   -O2  -funroll-loops -finline-functions -finline-limit=487

(the only difference is the inline-limit)

(In reply to comment #2)
> I'd love a suggestion on how the code could be changed so that I no longer get
> this segfault.

use a lower value for -finline-limit
Comment 4 H.J. Lu 2011-01-26 21:20:06 UTC
Works on 4.6.
Comment 5 H.J. Lu 2011-01-26 21:23:25 UTC
Works in 4.5.2.
Comment 6 H.J. Lu 2011-01-27 01:15:17 UTC
It is caused by revision 142056:


and is fixed/hidden by revision 145204:

Comment 7 Richard Biener 2011-01-27 11:18:17 UTC
Looks somewhat familiar:

Program received signal SIGSEGV, Segmentation fault.
0x00000000007648d5 in cancel_loop_tree (loop=0xa5a5a5a5a5a5a5a5)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/cfgloop.c:1305
1305      while (loop->inner)

#0  0x00000000007648d5 in cancel_loop_tree (loop=0xa5a5a5a5a5a5a5a5)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/cfgloop.c:1305
#1  0x00000000007648d1 in cancel_loop_tree (loop=0x7fffeeaee7e0)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/cfgloop.c:1306
#2  0x00000000007677da in remove_path (e=0x7fffee3f2040)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/cfgloopmanip.c:353
#3  0x00000000009b7afe in peel_loop_completely (loop=0x7fffeeaee480)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/loop-unroll.c:506
#4  0x00000000009b73bd in peel_loops_completely (flags=2)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/loop-unroll.c:248
#5  0x00000000009b6aaf in unroll_and_peel_loops (flags=2)
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/loop-unroll.c:157
#6  0x00000000009ac87e in rtl_unroll_and_peel_loops ()

Likely a dup of PR42229, fixed with

2009-12-02  Richard Guenther  <rguenther@suse.de>

        PR middle-end/42229
        * cfgloopmanip.c (remove_path): Avoid cancelling loops twice.
Comment 8 Mikael Pettersson 2011-01-29 16:15:57 UTC
(In reply to comment #7)
> Likely a dup of PR42229

Backporting the PR42229 fix to gcc-4.4.5 eliminates the ICE for both this test case and the PR42229 one.
Comment 9 Jakub Jelinek 2012-03-13 13:26:07 UTC
Fixed in 4.5+, 4.4 is no longer supported.
Comment 10 Jackie Rosen 2014-02-16 13:17:14 UTC Comment hidden (spam)