Bug 50099

Summary: ICE: internal compiler error: in extract_insn, at recog.c:2113 while building lttng-ust
Product: gcc Reporter: enrico.scholz
Component: targetAssignee: Bernd Schmidt <bernds>
Status: ASSIGNED ---    
Severity: normal CC: bernds, michael.hope, mikpelinux, mpthompson, patenaude, raj.khem, ramana, trippels
Priority: P3    
Version: 4.6.1   
Target Milestone: ---   
Host: Target: arm
Build: Known to work:
Known to fail: Last reconfirmed: 2011-09-06 00:00:00
Attachments: preprocessed sources (ust-0.15/snprintf/vfprintf.c)
reduced test case
Candidate patch

Description enrico.scholz 2011-08-16 13:04:26 UTC
Created attachment 25022 [details]
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
     (nil))
/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 <http://gcc.gnu.org/bugs.html> for instructions.


$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=$P/sysroots/x86_64-oe-linux/usr/libexec/armv5te-linux-gnueabi/gcc/arm-linux-gnueabi/4.6.1/lto-wrapper
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)
Comment 1 Mikael Pettersson 2011-08-16 13:35:54 UTC
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.
Comment 2 Mikael Pettersson 2011-08-16 20:28:54 UTC
It's caused by r163935:

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

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163935
Log:
	PR target/43137
	* config/arm/iterators.md (qhs_zextenddi_cond, qhs_sextenddi_cond):
	New define_mode_attrs.
	* config/arm/arm.md (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.md (thumb2_zero_extendsidi2,
	thumb2_zero_extendhidi2, thumb2_zero_extendqidi2, thumb2_extendsidi2,
	thumb2_extendhidi2, thumb2_extendqidi2): Delete.
Comment 3 Richard Biener 2011-08-17 08:12:50 UTC
*** Bug 50104 has been marked as a duplicate of this bug. ***
Comment 4 Mikael Pettersson 2011-08-17 13:35:59 UTC
Created attachment 25031 [details]
reduced test case
Comment 5 Greta Yorsh 2011-08-19 18:03:48 UTC
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
     (nil))
tst2.c:15:1: internal compiler error: in extract_insn, at recog.c:2115



-- Greta
Comment 6 Michael Hope 2011-09-04 23:55:51 UTC
Seen also when building perl with -marm:
 https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/838994

Exists in 4.6.1 and trunk r178025.  Does not exist in 4.5.3.
Comment 7 Michael Hope 2011-09-05 00:05:23 UTC
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;
      else
	range = 4096;
    }
  else
    range = (mode == HImode || mode == HFmode) ? 4095 : 4096;

The final 4096 range is incorrect for ARM mode sign extends.  The arm_arch4 path looks good.
Comment 8 Bernd Schmidt 2011-09-06 13:11:24 UTC
Created attachment 25202 [details]
Candidate patch
Comment 9 Ramana Radhakrishnan 2011-09-06 16:29:15 UTC
Oh fun - I posted a patch about 2 hours after you put yours here :) 

Ramana
Comment 10 Ramana Radhakrishnan 2011-09-30 09:36:47 UTC
Author: ramana
Date: Fri Sep 30 09:36:43 2011
New Revision: 179378

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179378
Log:

Fix PR target/50099


Added:
    trunk/gcc/testsuite/gcc.target/arm/pr50099.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.md
    trunk/gcc/config/arm/iterators.md
    trunk/gcc/config/arm/predicates.md
    trunk/gcc/testsuite/ChangeLog
Comment 11 Ramana Radhakrishnan 2012-11-28 03:22:18 UTC
*** Bug 52855 has been marked as a duplicate of this bug. ***
Comment 12 Ramana Radhakrishnan 2013-08-05 20:26:22 UTC
*** Bug 54473 has been marked as a duplicate of this bug. ***
Comment 13 Jackie Rosen 2014-02-16 13:16:26 UTC Comment hidden (spam)
Comment 14 StaffLeavers 2014-02-16 13:20:50 UTC
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 real-postmaster@arm.com

Thank you.
Comment 15 StaffLeavers 2014-02-16 13:23:02 UTC
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 real-postmaster@arm.com

Thank you.
Comment 16 StaffLeavers 2014-02-16 13:23:43 UTC
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 real-postmaster@arm.com

Thank you.
Comment 17 StaffLeavers 2014-02-16 13:24:25 UTC
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 real-postmaster@arm.com

Thank you.
Comment 18 StaffLeavers 2014-02-16 13:25:09 UTC
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 real-postmaster@arm.com

Thank you.
Comment 19 StaffLeavers 2014-02-16 13:25:50 UTC
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 real-postmaster@arm.com

Thank you.
Comment 20 StaffLeavers 2014-02-16 13:26:29 UTC
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 real-postmaster@arm.com

Thank you.
Comment 21 StaffLeavers 2014-02-16 13:27:09 UTC
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 real-postmaster@arm.com

Thank you.
Comment 22 StaffLeavers 2014-02-16 13:27:50 UTC
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 real-postmaster@arm.com

Thank you.
Comment 23 StaffLeavers 2014-02-16 13:28:33 UTC
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 real-postmaster@arm.com

Thank you.
Comment 24 StaffLeavers 2014-02-16 13:29:15 UTC
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 real-postmaster@arm.com

Thank you.
Comment 25 StaffLeavers 2014-02-16 13:29:55 UTC
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 real-postmaster@arm.com

Thank you.
Comment 26 StaffLeavers 2014-02-16 13:30:37 UTC
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 real-postmaster@arm.com

Thank you.
Comment 27 StaffLeavers 2014-02-16 13:31:19 UTC
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 real-postmaster@arm.com

Thank you.
Comment 28 StaffLeavers 2014-02-16 13:32:00 UTC
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 real-postmaster@arm.com

Thank you.
Comment 29 StaffLeavers 2014-02-16 13:32:40 UTC
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 real-postmaster@arm.com

Thank you.
Comment 30 StaffLeavers 2014-02-16 13:33:24 UTC
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 real-postmaster@arm.com

Thank you.
Comment 31 StaffLeavers 2014-02-16 13:34:05 UTC
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 real-postmaster@arm.com

Thank you.
Comment 32 StaffLeavers 2014-02-16 13:34:46 UTC
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 real-postmaster@arm.com

Thank you.
Comment 33 StaffLeavers 2014-02-16 13:35:26 UTC
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 real-postmaster@arm.com

Thank you.
Comment 34 StaffLeavers 2014-02-16 13:36:08 UTC
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 real-postmaster@arm.com

Thank you.
Comment 35 StaffLeavers 2014-02-16 13:36:50 UTC
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 real-postmaster@arm.com

Thank you.
Comment 36 StaffLeavers 2014-02-16 13:37:32 UTC
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 real-postmaster@arm.com

Thank you.
Comment 37 StaffLeavers 2014-02-16 13:38:14 UTC
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 real-postmaster@arm.com

Thank you.
Comment 38 StaffLeavers 2014-02-16 13:38:54 UTC
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 real-postmaster@arm.com

Thank you.
Comment 39 StaffLeavers 2014-02-16 13:39:35 UTC
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 real-postmaster@arm.com

Thank you.
Comment 40 StaffLeavers 2014-02-16 13:40:16 UTC
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 real-postmaster@arm.com

Thank you.
Comment 41 StaffLeavers 2014-02-16 13:40:50 UTC
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 real-postmaster@arm.com

Thank you.