Bug 49670 - internal compiler error: in extract_insn, at recog.c:2104
Summary: internal compiler error: in extract_insn, at recog.c:2104
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-07 18:26 UTC by Jeffrey Walton
Modified: 2018-12-09 04:52 UTC (History)
1 user (show)

See Also:
Host: x86
Target: i686
Build: Ubuntu/Linaro 4.5.2-8ubuntu4 (4.5.2)
Known to work:
Known to fail:
Last reconfirmed:


Attachments
File asn.s from class file causing internal compiler error (34.90 KB, application/octet-stream)
2011-07-08 08:35 UTC, Jeffrey Walton
Details
File asn.ii from class causing internal compiler error (112.65 KB, application/octet-stream)
2011-07-08 08:35 UTC, Jeffrey Walton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Walton 2011-07-07 18:26:27 UTC
Sorry if this was previously reported. Searching returned an error stating I used an invalid file extension.

I was attempting to compile the latest Crypto++ (svn checkout https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk/c5 cryptopp) on a Dell GX280 (32 bit Pentium 4). Here's the internal compiler error:

$ export PREFIX=/usr/local; make
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c 3way.cpp
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c adler32.cpp
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c algebra.cpp
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c algparam.cpp
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c arc4.cpp
g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c asn.cpp
asn.cpp: In member function ‘void CryptoPP::OID::DEREncode(CryptoPP::BufferedTransformation&) const’:
asn.cpp:254:1: error: unrecognizable insn:
(insn 194 178 195 2 asn.cpp:248 (set (reg:SI 2 cx)
        (mem:QI (plus:SI (reg/f:SI 1 dx [orig:61 D.44160 ] [61])
                (const_int 4 [0x4])) [16 S1 A32])) -1 (nil))
asn.cpp:254:1: internal compiler error: in extract_insn, at recog.c:2104
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
make: *** [asn.o] Error 1

===================================================================

Additional information

I modified Crypto++'s GNUMakefile a bit:

OLD:
    CXXFLAGS = -DNDEBUG -g O2
MOD:
    CXXFLAGS = -DNDEBUG -g -O2 -m32 -mtune=pentium4

When I invoked `make` I used the following:
    $ export PREFIX=/usr/local; make

$ g++ --version
g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux bruno 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux
jeffrey@bruno:~/Desktop/order-status$
Comment 1 Jeffrey Walton 2011-07-08 00:45:17 UTC
Using the stock Crypto++ makefile did not help:

g++ -DNDEBUG -g -O2 -mtune=native -pipe -c 3way.cpp
g++ -DNDEBUG -g -O2 -mtune=native -pipe -c adler32.cpp
g++ -DNDEBUG -g -O2 -mtune=native -pipe -c algebra.cpp
g++ -DNDEBUG -g -O2 -mtune=native -pipe -c algparam.cpp
g++ -DNDEBUG -g -O2 -mtune=native -pipe -c arc4.cpp
g++ -DNDEBUG -g -O2 -mtune=native -pipe -c asn.cpp
asn.cpp: In member function ‘void
CryptoPP::OID::DEREncode(CryptoPP::BufferedTransformation&) const’:
asn.cpp:254:1: error: unrecognizable insn:
(insn 194 178 195 2 asn.cpp:248 (set (reg:SI 2 cx)
       (mem:QI (plus:SI (reg/f:SI 1 dx [orig:61 D.44160 ] [61])
               (const_int 4 [0x4])) [16 S1 A32])) -1 (nil))
asn.cpp:254:1: internal compiler error: in extract_insn, at recog.c:2104
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
make: *** [asn.o] Error 1
Comment 2 Jeffrey Walton 2011-07-08 00:47:53 UTC
For completeness, here's the function (http://www.cryptopp.com/docs/ref/asn_8cpp_source.html):

00244 void OID::DEREncode(BufferedTransformation &bt) const
00245 {
00246         assert(m_values.size() >= 2);
00247         ByteQueue temp;
00248         temp.Put(byte(m_values[0] * 40 + m_values[1]));
00249         for (size_t i=2; i<m_values.size(); i++)
00250                 EncodeValue(temp, m_values[i]);
00251         bt.Put(OBJECT_IDENTIFIER);
00252         DERLengthEncode(bt, temp.CurrentSize());
00253         temp.TransferTo(bt);
00254 }
Comment 3 Uroš Bizjak 2011-07-08 07:54:33 UTC
Please add all information and especially preprocessed source, as explained in http://gcc.gnu.org/bugs/#detailed
Comment 4 Jeffrey Walton 2011-07-08 08:07:43 UTC
(In reply to comment #0)
> Sorry if this was previously reported. Searching returned an error stating I
> used an invalid file extension.
> 
> I was attempting to compile the latest Crypto++ (svn checkout
> https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk/c5 cryptopp) on a
> Dell GX280 (32 bit Pentium 4). Here's the internal compiler error:
> 
> $ export PREFIX=/usr/local; make
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c 3way.cpp
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c adler32.cpp
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c algebra.cpp
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c algparam.cpp
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c arc4.cpp
> g++ -DNDEBUG -g -O2 -m32 -mtune=pentium4 -march=native -pipe -c asn.cpp
> asn.cpp: In member function ‘void
> CryptoPP::OID::DEREncode(CryptoPP::BufferedTransformation&) const’:
> asn.cpp:254:1: error: unrecognizable insn:
> (insn 194 178 195 2 asn.cpp:248 (set (reg:SI 2 cx)
>         (mem:QI (plus:SI (reg/f:SI 1 dx [orig:61 D.44160 ] [61])
>                 (const_int 4 [0x4])) [16 S1 A32])) -1 (nil))
> asn.cpp:254:1: internal compiler error: in extract_insn, at recog.c:2104
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
> make: *** [asn.o] Error 1
> 
> [SNIP]
> 
> $ g++ --version
> g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
> Copyright (C) 2010 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It looks like removing `-mtune=native` fixed it:

$cat GNUMakefile
...
ifneq ($(GCC42_OR_LATER),0)
ifeq ($(UNAME),Darwin)
CXXFLAGS += -arch x86_64 -arch i386
else
# CXXFLAGS += -march=native
endif
endif
...

$ make
g++ -DNDEBUG -g -O2 -pipe -c 3way.cpp
g++ -DNDEBUG -g -O2 -pipe -c adler32.cpp
g++ -DNDEBUG -g -O2 -pipe -c algebra.cpp
g++ -DNDEBUG -g -O2 -pipe -c algparam.cpp
g++ -DNDEBUG -g -O2 -pipe -c arc4.cpp
g++ -DNDEBUG -g -O2 -pipe -c asn.cpp
g++ -DNDEBUG -g -O2 -pipe -c authenc.cpp
g++ -DNDEBUG -g -O2 -pipe -c base32.cpp
g++ -DNDEBUG -g -O2 -pipe -c base64.cpp
...
Comment 5 Jeffrey Walton 2011-07-08 08:35:11 UTC
Created attachment 24710 [details]
File asn.s from class file causing internal compiler error
Comment 6 Jeffrey Walton 2011-07-08 08:35:55 UTC
Created attachment 24711 [details]
File asn.ii from class causing internal compiler error
Comment 7 Jeffrey Walton 2011-07-08 08:36:08 UTC
(In reply to comment #3)
> Please add all information and especially preprocessed source, as explained in
> http://gcc.gnu.org/bugs/#detailed

Crypto++ sources:
`svn checkout https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk/c5 cryptopp`

Output from command is below, and asn.s attached:

jeffrey@bruno:~/Desktop/cryptopp$ make clean
...
jeffrey@bruno:~/Desktop/cryptopp$ gcc -v -save-temps -DNDEBUG -g -O2 -march=native -pipe -c asn.cpp 
gcc: warning: -pipe ignored because -save-temps specified
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DNDEBUG' '-g' '-O2'  '-pipe' '-c'
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -E -quiet -v -D_GNU_SOURCE -DNDEBUG asn.cpp -D_FORTIFY_SOURCE=2 -march=prescott --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=prescott -g -fworking-directory -O2 -fpch-preprocess -fstack-protector -o asn.ii
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.5
 /usr/include/c++/4.5/i686-linux-gnu
 /usr/include/c++/4.5/backward
 /usr/local/include
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DNDEBUG' '-g' '-O2'  '-pipe' '-c'
 /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/cc1plus -fpreprocessed asn.ii -march=prescott --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=prescott -quiet -dumpbase asn.cpp -auxbase asn -g -O2 -version -fstack-protector -o asn.s
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
	compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (i686-linux-gnu)
	compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0c5cb630517b5952f4898dfa56d7e8e5
asn.cpp: In member function ‘void CryptoPP::OID::DEREncode(CryptoPP::BufferedTransformation&) const’:
asn.cpp:254:1: error: unrecognizable insn:
(insn 191 175 192 2 asn.cpp:248 (set (reg:SI 2 cx)
        (mem:QI (plus:SI (reg/f:SI 1 dx [orig:60 D.44160 ] [60])
                (const_int 4 [0x4])) [16 S1 A32])) -1 (nil))
asn.cpp:254:1: internal compiler error: in extract_insn, at recog.c:2104
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
jeffrey@bruno:~/Desktop/cryptopp$
Comment 8 Uroš Bizjak 2011-07-08 09:42:59 UTC
The included source compiles OK for me with:

~/gcc-build/gcc/cc1plus -quiet -O2 -m32 -g -fstack-protector -march=prescott -mtune=prescott --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=1024 asn.ii

Tried with:
GNU C++ (GCC) version 4.5.4 20110525 (prerelease)
GNU C++ (GCC) version 4.6.1 20110611 (prerelease)
GNU C++ (GCC) version 4.7.0 20110707 (experimental)

The bug is either fixed or local to:

g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

Please try to reproduce the bug with latest FSF compiler. Alternatively, please report the bug to Ubuntu.
Comment 9 Jeffrey Walton 2011-07-08 09:51:21 UTC
(In reply to comment #8)
> The included source compiles OK for me with:
> 
> ~/gcc-build/gcc/cc1plus -quiet -O2 -m32 -g -fstack-protector -march=prescott
> -mtune=prescott --param l1-cache-size=16 --param l1-cache-line-size=64 --param
> l2-cache-size=1024 asn.ii
> 
> Tried with:
> GNU C++ (GCC) version 4.5.4 20110525 (prerelease)
> GNU C++ (GCC) version 4.6.1 20110611 (prerelease)
> GNU C++ (GCC) version 4.7.0 20110707 (experimental)
Interesting. If it matters, the hardware is a Dell GX280.

> The bug is either fixed or local to:
> 
> g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
> 
> Please try to reproduce the bug with latest FSF compiler. Alternatively, please
> report the bug to Ubuntu.
OK, thanks. The folks at Ubuntu are aware: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/807156.

Thanks for the quick response and help.
Comment 10 Jeffrey Walton 2011-07-09 03:32:20 UTC
(In reply to comment #8)
> The included source compiles OK for me with:
> 
> ~/gcc-build/gcc/cc1plus -quiet -O2 -m32 -g -fstack-protector -march=prescott
> -mtune=prescott --param l1-cache-size=16 --param l1-cache-line-size=64 --param
> l2-cache-size=1024 asn.ii
> 
> Tried with:
> GNU C++ (GCC) version 4.5.4 20110525 (prerelease)
> GNU C++ (GCC) version 4.6.1 20110611 (prerelease)
> GNU C++ (GCC) version 4.7.0 20110707 (experimental)
> 
> The bug is either fixed or local to:
> 
> g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
> 
> Please try to reproduce the bug with latest FSF compiler. Alternatively, please
> report the bug to Ubuntu.
I just tried using Fedora 15, which offers GCC 4.6 - OK.

Jeff

[jeffrey@studio cryptopp]$ gcc --version
gcc (GCC) 4.6.0 20110530 (Red Hat 4.6.0-9)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[jeffrey@studio cryptopp]$ make
g++ -DNDEBUG -g -O2 -march=native -pipe -c cryptlib_bds.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c hmac.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c hex.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c esign.cpp
...
g++ -DNDEBUG -g -O2 -march=native -pipe -c asn.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c rw.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c cast.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c tiger.cpp
...
Comment 11 Arseny Solokha 2018-12-09 04:41:16 UTC
I believe this is irrelevant by now.
Comment 12 Jeffrey Walton 2018-12-09 04:45:46 UTC
(In reply to Arseny Solokha from comment #11)
> I believe this is irrelevant by now.

Yeah, no doubt. May as well close it.
Comment 13 Jeffrey Walton 2018-12-09 04:52:41 UTC
Obsolete.