ICE building perl w/ -marm

Bug #838994 reported by dann frazier on 2011-09-01
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Ramana Radhakrishnan
Won't Fix
Linaro GCC Tracking
Fix Committed
In Progress
gcc-4.6 (Ubuntu)

Bug Description

# cc -DPERL_CORE -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat mg.c -marm
mg.c: In function 'Perl_magic_get':
mg.c:1088:1: error: unrecognizable insn:
(insn 1589 1588 1590 65 (set (reg:SI 2 r2)
        (sign_extend:SI (mem/s/j:QI (plus:SI (reg:SI 0 r0)
                    (const_int 1665 [0x681])) [0 my_perl_52(D)->Iutf8cache+0 S1 A8]))) mg.c:891 -1
mg.c:1088:1: internal compiler error: in extract_insn, at recog.c:2113
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccrtvyrR.out file, please attach this to your bugreport.

Created attachment 25022
preprocessed sources (ust-0.15/snprintf/vfprintf.c)

$ arm-linux-gnueabi-gcc -march=armv7-a /tmp/x2.c -c -O1
/tmp/x2.c: In function ‘ust_safe_vfprintf’:
/tmp/x2.c:4533:1: error: unrecognizable insn:
(insn 3114 3113 3115 139 (set (subreg:SI (reg/v:DI 153 [ _umax ]) 0)
        (sign_extend:SI (mem:QI (plus:SI (mult:SI (reg/v:SI 159 [ nextarg ])
                        (const_int 8 [0x8]))
                    (reg/f:SI 347 [ argtable.7 ])) [0 *D.5277_569+0 S1 A32]))) /tmp/x2.c:4325 -1
/tmp/x2.c:4533:1: internal compiler error: in extract_insn, at recog.c:2113
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.

$ arm-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: $P/work-shared/gcc-4.6.1+svnr175454/gcc-4_6-branch/configure --build=x86_64-oe-linux --host=x86_64-oe-linux --target=arm-linux-gnueabi --prefix=$P/sysroots/x86_64-oe-linux/usr --exec_prefix=$P/sysroots/x86_64-oe-linux/usr --bindir=$P/sysroots/x86_64-oe-linux/usr/bin/armv5te-linux-gnueabi --sbindir=$P/sysroots/x86_64-oe-linux/usr/bin/armv5te-linux-gnueabi --libexecdir=$P/sysroots/x86_64-oe-linux/usr/libexec/armv5te-linux-gnueabi --datadir=$P/sysroots/x86_64-oe-linux/usr/share --sysconfdir=$P/sysroots/x86_64-oe-linux/etc --sharedstatedir=$P/sysroots/x86_64-oe-linux/com --localstatedir=$P/sysroots/x86_64-oe-linux/var --libdir=$P/sysroots/x86_64-oe-linux/usr/lib/armv5te-linux-gnueabi --includedir=$P/sysroots/x86_64-oe-linux/usr/include --oldincludedir=$P/sysroots/x86_64-oe-linux/usr/include --infodir=$P/sysroots/x86_64-oe-linux/usr/share/info --mandir=$P/sysroots/x86_64-oe-linux/usr/share/man --disable-silent-rules --with-libtool-sysroot=$P/sysroots/x86_64-oe-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-linux-gnueabi- --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --enable-cheaders=c_global --with-abi=aapcs-linux --with-float=soft --with-local-prefix=$P/sysroots/toradex-colibri320/usr --with-gxx-include-dir=/usr/include/c++ --with-sysroot=$P/sysroots/toradex-colibri320 --with-build-sysroot=$P/sysroots/toradex-colibri320 --enable-poison-system-directories --with-headers=$P/sysroots/toradex-colibri320/usr/include --disable-libunwind-exceptions --with-mpfr=$P/sysroots/x86_64-oe-linux/usr --with-system-zlib --enable-nls --enable-__cxa_atexit --enable-__cxa_atexit
Thread model: posix
gcc version 4.6.1 20110627 (prerelease) (GCC)

(it is the gcc-4.6 from OpenEmbedded Core)

In , Mikpe (mikpe) wrote :

I can reproduce the ICE with 4.7-20110813 and 4.6-20110812, but not with 4.5-20110804, 4.4-20110719, or 4.3.5.

In , Mikpe (mikpe) wrote :

It's caused by r163935:

Author: bernds
Date: Mon Sep 6 22:32:26 2010
New Revision: 163935

 PR target/43137
 * config/arm/ (qhs_zextenddi_cond, qhs_sextenddi_cond):
 New define_mode_attrs.
 * config/arm/ (zero_extendsidi2, arm_zero_extendsidi2,
 arm_exxtendsidi2, arm_extendsidi2): Delete patterns.
 (zero_extend<mode>di2, extend<mode>di2 and related splits): New.
 (thumb1_zero_extendhisi2): Remove code to handle LABEL_REFs.
 Remove pool_range attribute.
 (arm_zero_extendhisi2, arm_zero_extendhisi2_v6, arm_zero_extendqisi2,
 arm_zero_extendqisi2_v6, thumb1_zero_extendqisi2_v6): Remove
 pool_range and neg_pool_range attributes.
 * config/arm/ (thumb2_zero_extendsidi2,
 thumb2_zero_extendhidi2, thumb2_zero_extendqidi2, thumb2_extendsidi2,
 thumb2_extendhidi2, thumb2_extendqidi2): Delete.

In , Rguenth (rguenth) wrote :

*** Bug 50104 has been marked as a duplicate of this bug. ***

In , Mikpe (mikpe) wrote :

Created attachment 25031
reduced test case

I can reproduce it with GCC 4.7 r177601 with -marm but not with -mthumb.
Here a smaller test case that seems related.

> cat tst2.c

typedef signed char int8_t ;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;

// doesn't ice if arg is unsigned
// doesn't ice if return is int32_t instead of int64_t
int64_t foo(int8_t * arg)
  //int64_t temp_1;
  int64_t temp_1;

  temp_1 = arg[256]; // index must be > 255 to ice!
  return temp_1;

> arm-none-eabi-gcc -O1 tst2.c

tst2.c: In function 'foo':
tst2.c:15:1: error: unrecognizable insn:
(insn 22 21 23 2 (set (subreg:SI (reg:DI 138 [ MEM[(int8_t *)arg_1(D) + 256B] ]) 0)
        (sign_extend:SI (mem:QI (plus:SI (reg:SI 0 r0 [ arg ])
                    (const_int 256 [0x100])) [0 MEM[(int8_t *)arg_1(D) + 256B]+0 S1 A8]))) tst2.c:13 -1
tst2.c:15:1: internal compiler error: in extract_insn, at recog.c:2115

-- Greta

dann frazier (dannf) wrote :
dann frazier (dannf) wrote :
Download full text (4.5 KiB)

# gcc -v -save-temps -DPERL_CORE -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat mg.c -marm
gcc: warning: -pipe ignored because -save-temps specified
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-7ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-7ubuntu2)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-D' 'PERL_CORE' '-c' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D' 'DEBIAN' '-fno-strict-aliasing' '-pipe' '-fstack-protector' '-I' '/usr/local/include' '-D' '_LARGEFILE_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-O2' '-g' '-Wall' '-Wextra' '-Wdeclaration-after-statement' '-Wendif-labels' '-Wc++-compat' '-marm' '-march=armv7-a' '-mfloat-abi=softfp' '-mfpu=vfpv3-d16'
 /usr/lib/gcc/arm-linux-gnueabi/4.6.1/cc1 -E -quiet -v -I /usr/local/include -imultilib . -imultiarch arm-linux-gnueabi -D PERL_CORE -D _REENTRANT -D _GNU_SOURCE -D DEBIAN -D _LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 mg.c -marm -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wall -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -fno-strict-aliasing -fstack-protector -g -fworking-directory -O2 -fpch-preprocess -fstack-protector -o mg.i
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabi"
ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../../arm-linux-gnueabi/include"
ignoring duplicate directory "/usr/local/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-D' 'PERL_CORE' '-c' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D' 'DEBIAN' '-fno-strict-aliasing' '-pipe' '-fstack-protector' '-I' '/usr/local/include' '-D' '_LARGEFILE_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-O2' '-g' '-Wall' '-Wextra' '-Wdeclaration-after-statement' '-Wendif-labels' '-Wc++-compat' '-marm' '-march=armv7-a' '-mfloat-abi=softfp' '-mfpu=vfpv3-d16'
 /usr/lib/gcc/arm-linux-gnueabi/4.6.1/cc1 -fpreprocess...


dann frazier (dannf) wrote :

I'll attempt to reproduce with lp:gcc-linaro/4.6

Changed in gcc-4.6 (Ubuntu):
status: New → Confirmed
Al Stone (ahs3) wrote :

I believe this same problem may have been reported to upstream:

Same ICE, but different source evoking it.

Michael Hope (michaelh1) wrote :

Thank you for the bug report. I've confirmed this with gcc-linaro-4.6-2011.08 on ARM:

michaelh@ursa1:~/linaro/bugs$ /tools/toolchains/arch/armv7l/gcc-linaro-4.6-2011.08-armv7l-natty-cbuild162-ursa1-cortexa9r1/bin/gcc -marm -O2 -c lp838994.i
mg.c: In function 'Perl_magic_get':
mg.c:1088:1: error: unrecognizable insn:
(insn 1520 1519 1521 65 (set (reg:SI 2 r2)
        (sign_extend:SI (mem/s:QI (plus:SI (reg:SI 0 r0)
                    (const_int 1665 [0x681])) [0 my_perl_52(D)->Iutf8cache+0 S1 A8]))) mg.c:891 -1
mg.c:1088:1: internal compiler error: in extract_insn, at recog.c:2113

The fault is correct - the RTL attempts to do a sign extending load from an address +1665 bytes, where ARM mode supports offsets of 0 to 255 bytes. Thumb-2 supports 0 to 4095 bytes.

The work-around is to compile at -O0. The fault also exists in gcc-4.6.1 and trunk r178025. It does not exist in gcc-4.5.3.

I've set it to medium priority as it is a ftbfs, a (mediocre) work-around exists, this is a significant package, and the fault exists upstream.

Seen also when building perl with -marm:

Exists in 4.6.1 and trunk r178025. Does not exist in 4.5.3.

Changed in gcc-linaro:
status: New → Triaged
importance: Undecided → Medium

arm_legitimate_index_p() seems to be wrong. Near the end it has:

  /* For ARM v4 we may be doing a sign-extend operation during the
     load. */
  if (arm_arch4)
      if (mode == HImode
   || mode == HFmode
   || (outer == SIGN_EXTEND && mode == QImode))
 range = 256;
 range = 4096;
    range = (mode == HImode || mode == HFmode) ? 4095 : 4096;

The final 4096 range is incorrect for ARM mode sign extends. The arm_arch4 path looks good.

Michael Hope (michaelh1) on 2011-09-05
Changed in gcc-linaro:
assignee: nobody → Ramana Radhakrishnan (ramana)
Changed in gcc:
importance: Unknown → Medium
status: Unknown → New

Created attachment 25202
Candidate patch

Oh fun - I posted a patch about 2 hours after you put yours here :)


Changed in gcc:
status: New → In Progress
Michael Hope (michaelh1) on 2011-09-07
Changed in gcc-linaro:
status: Triaged → In Progress
Changed in gcc-linaro:
milestone: none → 4.6-2011.09
Michael Hope (michaelh1) wrote :

Confirmed the fix.

Changed in gcc-linaro:
status: In Progress → Fix Committed
Michael Hope (michaelh1) on 2011-09-16
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.6 - 4.6.1-9ubuntu3

gcc-4.6 (4.6.1-9ubuntu3) oneiric; urgency=low

  * Fix PR target/50193 (ARM). ICE on a | (b << negative-constant).
  * Fix PR target/50099 (ARM). ICE in arm mode. LP: #838994.
  * gcc.c (for_each_path): Allocate memory for multiarch suffix.
 -- Matthias Klose <email address hidden> Fri, 16 Sep 2011 13:53:30 +0200

Changed in gcc-4.6 (Ubuntu):
status: Confirmed → Fix Released
Michael Hope (michaelh1) wrote :

Exists upstream but the fix hasn't landed upstream. Backport to stable once it has.

Author: ramana
Date: Fri Sep 30 09:36:43 2011
New Revision: 179378


Fix PR target/50099


This is a backport from upstream:
Related: lp:gcc-linaro/4.6,revno=106806

Changed in gcc-linaro-tracking:
milestone: none → 4.7.0
status: New → Fix Committed

*** Bug 52855 has been marked as a duplicate of this bug. ***

*** Bug 54473 has been marked as a duplicate of this bug. ***

*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain
Page where seen:
Marked for reference. Resolved as fixed @bugzilla.

greta.yorsh no longer works for ARM.

Your email will be forwarded to their line manager.

Please do not reply to this email.
If you need more information, please email <email address hidden>

Thank you.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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