GCC (g++):internal compiler error: in extract_insn, at recog.c:2104

Bug #807156 reported by Jeffrey Walton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Won't Fix
Medium
Michael Collison
4.5
Triaged
Medium
Unassigned
gcc
Invalid
Medium
gcc-4.5 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

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:

$ make
g++ -DNDEBUG -g -O2 -march=native -pipe -c 3way.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c adler32.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c algebra.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c algparam.cpp
g++ -DNDEBUG -g -O2 -march=native -pipe -c arc4.cpp
g++ -DNDEBUG -g -O2 -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

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

$ 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$

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

Also reported to GCC at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49670.

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

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$

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

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

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

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 }

Revision history for this message
In , Ubizjak (ubizjak) wrote :

Please add all information and especially preprocessed source, as explained in http://gcc.gnu.org/bugs/#detailed

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

(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
...

Revision history for this message
Jeffrey Walton (noloader) wrote :

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
...

Revision history for this message
Matthias Klose (doko) wrote :

upstream did ask you to attach the preprocessed source. please do so.
please recheck with gcc-4.6 (for example in a oneiric chroot)

affects: gcc-defaults (Ubuntu) → gcc-4.5 (Ubuntu)
Changed in gcc-4.5 (Ubuntu):
status: New → Incomplete
Revision history for this message
In , Jeffrey Walton (noloader) wrote :

Created attachment 24710
File asn.s from class file causing internal compiler error

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

Created attachment 24711
File asn.ii from class causing internal compiler error

Revision history for this message
In , Jeffrey Walton (noloader) wrote :
Download full text (3.9 KiB)

(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 b...

Read more...

Revision history for this message
Jeffrey Walton (noloader) wrote :

> upstream did ask you to attach the preprocessed source. please do so.
Done. Thanks for taking the time.

Revision history for this message
In , Ubizjak (ubizjak) wrote :

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.

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

(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.

Revision history for this message
Jeffrey Walton (noloader) wrote :
Revision history for this message
In , Jeffrey Walton (noloader) wrote :

(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
...

Revision history for this message
Jeffrey Walton (noloader) wrote :

> please recheck with gcc-4.6 (for example in a oneiric chroot)
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

Revision history for this message
Michael Hope (michaelh1) wrote :

Thank you for the bug report. I've confirmed this with gcc-linaro-4.5-2011.06-0 on x86_64 in 32 bit mode:

michaelh@crucis:~/linaro/bugs$ ~/linaro/toolchains/gcc-linaro-4.5-2011.06-0-x86_64-maverick-cbuild130-crucis-x86_64r1/bin/g++ -c -O2 -m32 -g -march=prescott -mtune=prescott asn.ii
asn.cpp: In member function ‘void CryptoPP::OID::DEREncode(CryptoPP::BufferedTransformation&) const’:
asn.cpp:254:1: error: unrecognizable insn:
(insn 178 162 179 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:2110

The work around is to compile without -march=prescot. The fault was introduced in gcc-linaro-4.5-2011.03-0. It does not exist in gcc-linaro-4.6-2011.06-0, gcc 4.5, gcc 4.6, or gcc trunk r176133.

I've set it to medium priority as it is a ftbfs and has a work around.

Changed in gcc-linaro:
status: New → Triaged
importance: Undecided → Medium
Changed in gcc:
importance: Unknown → Medium
status: Unknown → New
Matthias Klose (doko)
Changed in gcc-4.5 (Ubuntu):
importance: Undecided → Medium
status: Incomplete → Triaged
Revision history for this message
Michael Collison (michael-collison) wrote :

Will not fix for older releases. Does not occur on x86 linaro 4.8 or 4.9

Changed in gcc-linaro:
assignee: nobody → Michael Collison (michael-collison)
status: Triaged → Won't Fix
Revision history for this message
In , Asolokha (asolokha) wrote :

I believe this is irrelevant by now.

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

(In reply to Arseny Solokha from comment #11)
> I believe this is irrelevant by now.

Yeah, no doubt. May as well close it.

Revision history for this message
In , Jeffrey Walton (noloader) wrote :

Obsolete.

Changed in gcc:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.