Bug 27829 - ICE/abort in shift_op, at config/arm/arm.c:7917 with asm from testsuite/gcc.dg/pr21255-2-mb.c
Summary: ICE/abort in shift_op, at config/arm/arm.c:7917 with asm from testsuite/gcc.d...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.4
: P3 normal
Target Milestone: 4.2.0
Assignee: Richard Earnshaw
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2006-05-31 01:56 UTC by Flash Sheridan
Modified: 2006-05-31 13:50 UTC (History)
2 users (show)

See Also:
Host:
Target: armv5te-softfloat-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-31 10:12:19


Attachments
Preprocessed source file (178 bytes, text/plain)
2006-05-31 01:57 UTC, Flash Sheridan
Details
patch in testing (319 bytes, patch)
2006-05-31 10:13 UTC, Richard Earnshaw
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Flash Sheridan 2006-05-31 01:56:11 UTC
Calling an ARM-targeted GCC 3.4.4 on the testsuite file gcc.dg/pr21255-2-mb.c results in "internal compiler error: in shift_op, at config/arm/arm.c:7917".  

A slightly reduced version of the file is:

double d;
double
f (void)
{
  double r;
  asm ("mov %S1,%S0; mov %R1,%R0" : "=&r" (r) : "m" (d));
  return r;
}

The relevant source seems to be:

  if (GET_CODE (XEXP (op, 1)) == REG || GET_CODE (XEXP (op, 1)) == SUBREG)
    *amountp = -1;
  else if (GET_CODE (XEXP (op, 1)) == CONST_INT)
    *amountp = INTVAL (XEXP (op, 1));
  else
    abort ();

CodeSourcery versions 3.4.4 (release) (CodeSourcery ARM 2005q3-2) and 2006q1/4.1.0 give a similar error.
x86 GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2), and a checking=all build of 4.1.0 instead give an apparently reasonable rejection message: "error: invalid `asm': invalid operand code `R'".


================
Here's the session; I'll attach the preprocessed source.

48> /opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/armv5te-softfloat-linux-gnu-gcc -v -save-temps /opt/Gcc-4.1.0-dist/gcc/testsuite/gcc.dg/pr21255-2-mb.c
Reading specs from /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/specs
Configured with: /home/kenneth.albanowski/projects/dev/open-source/crosstool/main/dist/build/armv5te-softfloat-linux-gnu/gcc-3.4.4-glibc-2.3.5/gcc-3.4.4/configure --target=armv5te-softfloat-linux-gnu --host=i686-host_pc-linux-gnu --prefix=/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu --with-float=soft --with-arch=armv5te --enable-cxx-flags=-march=armv5te --with-headers=/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/armv5te-softfloat-linux-gnu/include --with-local-prefix=/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/armv5te-softfloat-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.4
 /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../libexec/gcc/armv5te-softfloat-linux-gnu/3.4.4/cc1 -E -quiet -v -iprefix /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/ -D__ARM_ARCH_5TE__ /opt/Gcc-4.1.0-dist/gcc/testsuite/gcc.dg/pr21255-2-mb.c -march=armv5te -msoft-float -o pr21255-2-mb.i
ignoring duplicate directory "/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/include"
ignoring duplicate directory "/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/../../../../armv5te-softfloat-linux-gnu/sys-include"
ignoring duplicate directory "/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/../../../../armv5te-softfloat-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/include
 /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/../../../../armv5te-softfloat-linux-gnu/sys-include
 /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../lib/gcc/armv5te-softfloat-linux-gnu/3.4.4/../../../../armv5te-softfloat-linux-gnu/include
End of search list.
 /home/opt/crosstool/gcc-3.4.4-glibc-2.3.5/armv5te-softfloat-linux-gnu/bin/../libexec/gcc/armv5te-softfloat-linux-gnu/3.4.4/cc1 -fpreprocessed pr21255-2-mb.i -quiet -dumpbase pr21255-2-mb.c -march=armv5te -msoft-float -auxbase pr21255-2-mb -version -o pr21255-2-mb.s
GNU C version 3.4.4 (armv5te-softfloat-linux-gnu)
        compiled by GNU C version 3.3.5 (Debian 1:3.3.5-8ubuntu2).
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=62500
/opt/Gcc-4.1.0-dist/gcc/testsuite/gcc.dg/pr21255-2-mb.c: In function `f':
/opt/Gcc-4.1.0-dist/gcc/testsuite/gcc.dg/pr21255-2-mb.c:19: internal compiler error: in shift_op, at config/arm/arm.c:7917
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Flash Sheridan 2006-05-31 01:57:26 UTC
Created attachment 11542 [details]
Preprocessed source file
Comment 2 Drea Pinski 2006-05-31 02:01:40 UTC
Does this happen in 3.4.5 or 3.4.6?

Also 3.4.x is no longer being maintainer, does this happen in 4.0.x or 4.1.x?
Comment 3 Flash Sheridan 2006-05-31 02:14:07 UTC
It does happen in CodeSourcery's version of 4.1.0 (which I've filed noted above and with them).  I don't have access to an ARM-targeted 3.4.5, 3.4.6, 4.0.x, nor a non-CodeSourcery 4.1.x.
Comment 4 Richard Earnshaw 2006-05-31 10:12:19 UTC
Confirmed on trunk.
Comment 5 Richard Earnshaw 2006-05-31 10:13:43 UTC
Created attachment 11549 [details]
patch in testing
Comment 6 Richard Earnshaw 2006-05-31 13:41:16 UTC
Subject: Bug 27829

Author: rearnsha
Date: Wed May 31 13:41:08 2006
New Revision: 114265

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114265
Log:
	PR target/27829
	* arm.c (arm_print_operand case 'S'): Validate that the operand is
	a shift operand before calling shift_op.  Avoid redundant call of
	shift_op.

Modified:
    trunk/gcc/ChangeLog

Comment 7 Richard Earnshaw 2006-05-31 13:50:13 UTC
patch installed
Comment 8 Carlos O'Donell 2006-06-01 03:43:08 UTC
Subject: Bug 27829

Author: carlos
Date: Thu Jun  1 03:43:00 2006
New Revision: 114294

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

2006-05-31  Carlos O'Donell  <carlos@codesourcery.com>

	Backport from mainline:
	2006-05-31  Richard Earnshaw  <richard.earnshaw@arm.com>
	PR target/27829
	* gcc/config/arm/arm.c (arm_print_operand case 'S'): Validate 
	that the operand is a shift operand before calling shift_op.  
	Avoid redundant call of	shift_op.


Modified:
    branches/csl/sourcerygxx-4_1/ChangeLog.csl
    branches/csl/sourcerygxx-4_1/gcc/config/arm/arm.c