Bug 50873 - The fix to PR50730 causes gcc.c-torture/unsorted/dilayout.c to ICE
Summary: The fix to PR50730 causes gcc.c-torture/unsorted/dilayout.c to ICE
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Richard Sandiford
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-26 13:45 UTC by Matthew Gretton-Dann
Modified: 2012-01-18 09:32 UTC (History)
2 users (show)

See Also:
Host:
Target: arm*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-10-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Gretton-Dann 2011-10-26 13:45:29 UTC
The fix to PR50730 (revision 180367 - http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180367) causes the test gcc.c-torture/unsorted/dilayout.c to ICE at -O3.

A reduced test case is:

$ cat test.c
/* arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=soft -O3 test.c  */
struct ii
{
  int a;
  int b;
};
struct foo
{
  int a;
  struct ii ab;
};
struct ii
foo (int *p, struct foo a)
{
  p[0] = a.a;
  p[1] = a.ab.a;
}
/* end of test.c.  */
$ arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=soft -O3 test.c
test.c: In function 'foo':
test.c:15:11: internal compiler error: in expand_insn, at optabs.c:7693

-fno-tree-vectorize causes the issue to go away.

The issue still exists in revision 180524
Comment 1 Ira Rosen 2011-10-27 08:44:32 UTC
I see this too, but I don't think it's my patch's fault. I reverted it and the reduced test still failed. The patch makes no difference for this basic block - it gets vectorized with or without it.
Comment 2 Matthew Gretton-Dann 2011-10-27 13:31:27 UTC
(In reply to comment #1)
> I see this too, but I don't think it's my patch's fault. I reverted it and the
> reduced test still failed. The patch makes no difference for this basic block -
> it gets vectorized with or without it.

Apologies if I've miss labelled this issue - git bisect suggested that r180367 was where the issue was introduced.  I will take another look this afternoon to see if I misread the output and it was another check-in nearby.
Comment 3 Richard Sandiford 2011-12-07 11:45:40 UTC
We need to tweak maybe_legitimize_operand_same_code
(thanks Ramana for the heads-up).  Testing a fix.
Comment 4 Richard Sandiford 2011-12-12 15:18:29 UTC
Author: rsandifo
Date: Mon Dec 12 15:18:24 2011
New Revision: 182244

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182244
Log:
gcc/
	PR middle-end/50873
	* optabs.c (maybe_legitimize_operand_same_code): Use copy_to_mode_reg
	instead of force_reg.  Do nothing if the address is already a
	non-virtual pseudo register.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/optabs.c
Comment 5 Richard Sandiford 2012-01-18 09:32:44 UTC
Fixed on trunk.