User account creation filtered due to spam.

Bug 51915

Summary: [4.7 Regression] ICE in output_move_double
Product: gcc Reporter: Jakub Jelinek <jakub>
Component: targetAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: carrot, ramana
Priority: P1 Keywords: ice-on-valid-code
Version: 4.7.0   
Target Milestone: 4.7.0   
Host: Target: arm-linux-gnueabi
Build: Known to work:
Known to fail: Last reconfirmed: 2012-01-20 00:00:00
Attachments: gcc47-pr51915.patch

Description Jakub Jelinek 2012-01-20 12:58:10 UTC
The following testcase started ICEing probably with PR50022 change:
./xgcc -B ./ -march=armv7-a -mfloat-abi=hard -O2 rh783334.c
rh783334.c: In function ‘bar’:
rh783334.c:12:1: internal compiler error: in output_move_double, at config/arm/arm.c:13951
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

/* { dg-do compile } */
/* { dg-options "-march=armv7-a -mfloat-abi=hard -O2" } */

struct S { int s1; void *s2; };
struct T { struct S t1; unsigned long long t2; };
struct S *foo (unsigned long long);

struct S *
bar (struct S *x)
{
  return foo (((struct T *) x)->t2);
}
Comment 1 Jakub Jelinek 2012-01-20 13:16:42 UTC
Created attachment 26394 [details]
gcc47-pr51915.patch

Untested fix.

output_move_double (sometimes intentionally) modifies the operands array, because it returns a pattern that should be emitted by the caller in some cases.
But if that is done already when !emit, when just counting the insns, when output_move_double is called with emit=true, we ICE.
Comment 2 Jakub Jelinek 2012-01-20 13:17:49 UTC
Ramana, if this patch looks ok to you, can you please bootstrap/regtest it?  Thanks.
Comment 3 Jakub Jelinek 2012-01-20 19:39:53 UTC
Author: jakub
Date: Fri Jan 20 19:39:48 2012
New Revision: 183349

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183349
Log:
	PR target/51915
	* config/arm/arm.c (arm_count_output_move_double_insns): Call
	output_move_double on a copy of operands array.

	* gcc.target/arm/pr51915.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr51915.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2012-01-20 20:03:50 UTC
Fixed.
Comment 5 Jakub Jelinek 2012-01-20 20:08:39 UTC
*** Bug 51659 has been marked as a duplicate of this bug. ***
Comment 6 jye2 2012-06-08 08:58:01 UTC
Author: jye2
Date: Fri Jun  8 08:57:53 2012
New Revision: 188332

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188332
Log:
2012-06-08  Joey Ye  <joey.ye@arm.com>

	Backport r184442 from mainline
	2012-02-21  Richard Earnshaw  <rearnsha@arm.com>

	PR target/52294
	* thumb2.md (thumb2_shiftsi3_short): Split register and         
	immediate shifts.  For register shifts tie operands 0 and 1.
	(peephole2 for above): Check that register-controlled shifts
	have suitably tied operands.

	Backport r183756 from mainline
	2012-01-31  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* config/arm/thumb2.md (thumb2_mov_notscc): Use MVN for true
	condition.

	Backport r183349 from mainline
	2012-01-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/51915
	* config/arm/arm.c (arm_count_output_move_double_insns): Call
	output_move_double on a copy of operands array.

	Backport r183095 from mainline
	2012-01-11  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* config/arm/arm.md (mov_notscc): Use MVN for false condition.

	Backport r182628 from mainline
	2011-12-21  Richard Earnshaw  <rearnsha@arm.com>

	PR target/51643
	* arm.c (arm_function_ok_for_sibcall): Use DECL_WEAK in previous
	change.

	Backport r182621 from mainline
	2011-12-21  Richard Earnshaw  <rearnsha@arm.com>

	PR target/51643
	* arm.c (arm_function_ok_for_sibcall): Don't try to tailcall a
	weak function on bare-metal EABI targets.

Testsuite:
	Backport r183349 from mainline
	2012-01-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/51915
	* gcc.target/arm/pr51915.c: New test.

	Backport r183095 from mainline
	2012-01-11  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* gcc.c-torture/execute/20120110-1.c: New testcase.

	Backport r182621 from mainline
	2011-12-21  Richard Earnshaw  <rearnsha@arm.com>

	PR target/51643
	* gcc.target/arm/sibcall-2.c: New test.


Added:
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.c-torture/execute/20120111-1.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.target/arm/pr51915.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.target/arm/sibcall-2.c
Modified:
    branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.c
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.md
    branches/ARM/embedded-4_6-branch/gcc/config/arm/thumb2.md
    branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm