Bug 65576 - [5 Regression] ICE in gcc.c-torture/compile/pr33855.c
Summary: [5 Regression] ICE in gcc.c-torture/compile/pr33855.c
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Alan Modra
URL: https://gcc.gnu.org/ml/gcc-patches/20...
: 65577 (view as bug list)
Depends on:
Reported: 2015-03-26 02:37 UTC by Martin Sebor
Modified: 2015-04-03 23:18 UTC (History)
2 users (show)

See Also:
Target: powerpc64-*-linux-*
Known to work:
Known to fail:
Last reconfirmed: 2015-04-01 00:00:00

Proposed patch to fix the problem (1.56 KB, patch)
2015-04-01 21:20 UTC, Michael Meissner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2015-03-26 02:37:59 UTC
Compiling the gcc.c-torture/compile/pr33855.c test with yesterday's trunk (r221640) on powerpc64 (a POWER7 processor) fails with the ICE below.  Adding #include <complex.h> doesn't help.  I don't see this ICE on powerpc64le.

$ gcc -O2 -c /src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c: In function ‘foo’:
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:21:11: warning: implicit declaration of function ‘cabsl’ [-Wimplicit-function-declaration]
       if (cabsl(vsorc.vqd[indx]) < 1.e-20)
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:21:11: warning: incompatible implicit declaration of built-in function ‘cabsl’
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:21:11: note: include ‘<complex.h>’ or provide a declaration of ‘cabsl’
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:27:1: error: unrecognizable insn:
(insn 130 129 44 5 (set (reg:DF 10 10)
        (mem/u/c:DF (symbol_ref/u:DI ("*.LC5") [flags 0x82]) [8  S8 A64])) /src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:20 -1
/src/gcc-trunk/gcc/testsuite/gcc.c-torture/compile/pr33855.c:27:1: internal compiler error: in extract_insn, at recog.c:2343
0x107a403b _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
0x107a408f _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
0x10769a27 extract_insn(rtx_insn*)
0x10769ae7 extract_insn_cached(rtx_insn*)
0x1048f677 cleanup_subreg_operands(rtx_insn*)
0x107a15d7 reload(rtx_insn*, int)
0x1062ec17 do_reload
0x1062ec17 execute
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Martin Sebor 2015-03-26 19:06:25 UTC
git bisect pinpointed the following as the commit that introduced the ICE:

commit 2d5ee2b9035db2414ae3535db18550c1d90e52fd
Author: meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Mar 19 22:37:33 2015 +0000

    2015-03-19  Michael Meissner  <meissner@linux.vnet.ibm.com>
    	PR target/65240
    	* config/rs6000/predicates.md (easy_fp_constant): Remove special
    	-ffast-math handling that kept non-0 constants live in the RTL
    	until reload.  Remove logic testing the number of instructions it
    	took to create a constant in a GPR that was never used, due to a
    	test for soft-float earlier.
    	(memory_fp_constant): Delete, no longer used.
    	* config/rs6000/rs6000.md (mov<MODE>_hardfloat): Remove
    	alternatives for loading non-0 constants into GPRs for hard
    	floating point that is no longer needed due to changes in
    	easy_fp_constant.  Add support for loading 0.0 into GPRs.
    	(mov<mode>_hardfloat32): Likewise.
    	(mov<mode>_hardfloat64): Likewise.
    	(mov<mode>_64bit_dm): Likewise.
    	(movtd_64bit_nodm): Likewise.
    	(pre-reload move FP constant define_split): Delete define_split,
    	since it is no longer used.
    	(extenddftf2_internal): Remove GHF constraints that are not valid
    	for extenddftf2.
    2015-03-19  Michael Meissner  <meissner@linux.vnet.ibm.com>
    	PR target/65240
    	* gcc/testsuite/g++.dg/pr65240.h: Add tests for PR 65240.
    	* gcc/testsuite/g++.dg/pr65240-1.C: Likewise.
    	* gcc/testsuite/g++.dg/pr65240-2.C: Likewise.
    	* gcc/testsuite/g++.dg/pr65240-3.C: Likewise.
    	* gcc/testsuite/g++.dg/pr65240-4.C: Likewise.
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221524 138bc75d-0d04-0410-961f-82ee72b054a4
Comment 2 Martin Sebor 2015-03-26 20:26:09 UTC
*** Bug 65577 has been marked as a duplicate of this bug. ***
Comment 3 Martin Sebor 2015-03-30 18:57:44 UTC
Test still fails today (r221770).
Comment 4 Alan Modra 2015-04-01 12:26:57 UTC
Confirmed.  The failure occurs with -mcpu=power6x or lower.
Comment 5 Michael Meissner 2015-04-01 21:20:09 UTC
Created attachment 35208 [details]
Proposed patch to fix the problem

I haven't yet done a full bootstrap build/make check, but I believe this patch fixes the problem.

The problem was for non-VSX systems, it still allowed 0.0 as the second argument for the DF->TF expand insn, and reload tried to use it.  I rewrote it to only require register for pre-VSX systems.
Comment 6 Alan Modra 2015-04-02 01:38:31 UTC
The patch does appear to fix the problem for non-power7, but introduces an ICE on power7 for pr33855.c.

gcc.c-torture/compile/pr33855.c:27:1: error: unrecognizable insn:
(insn 124 123 31 5 (set (mem:DF (plus:DI (reg/f:DI 31 31 [orig:161 D.2367 ] [161])
                (const_int 24 [0x18])) [5 *_13+24 S8 A64])
        (const_double:DF 0.0 [0x0.0p+0])) /src/gcc-virgin/gcc/testsuite/gcc.c-torture/compile/pr33855.c:20 -1
Comment 7 Alan Modra 2015-04-02 05:24:27 UTC
Alternate patch posted
Comment 8 Alan Modra 2015-04-03 23:16:59 UTC
Author: amodra
Date: Fri Apr  3 23:16:26 2015
New Revision: 221862

URL: https://gcc.gnu.org/viewcvs?rev=221862&root=gcc&view=rev
	PR target/65576
	PR target/65240
	* config/rs6000/predicates.md (zero_reg_mem_operand): Exclude
	0.0 constant unless TARGET_VSX.
	* config/rs6000/rs6000.md (extenddftf2_internal): Remove last

Comment 9 Alan Modra 2015-04-03 23:18:32 UTC