Bug 90139 - [7/8 Regression] ICE in emit_block_move_hints, at expr.c:1601
Summary: [7/8 Regression] ICE in emit_block_move_hints, at expr.c:1601
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 9.0
: P1 normal
Target Milestone: 9.3
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2019-04-18 12:52 UTC by Rainer Orth
Modified: 2019-08-30 13:33 UTC (History)
1 user (show)

See Also:
Host:
Target: sparc*-sun-solaris2.11
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-04-18 00:00:00


Attachments
reduced testcase (219 bytes, text/plain)
2019-04-18 12:52 UTC, Rainer Orth
Details
gcc9-pr90139.patch (637 bytes, patch)
2019-04-18 13:44 UTC, Jakub Jelinek
Details | Diff
gcc 7 reduced testcase (223 bytes, text/plain)
2019-04-23 12:31 UTC, Rainer Orth
Details
gcc 8 reduced testcase (237 bytes, text/plain)
2019-04-23 12:33 UTC, Rainer Orth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2019-04-18 12:52:51 UTC
Created attachment 46194 [details]
reduced testcase

The following reduced testcase ICEs on trunk:

$ ./xg++ -B./ -S -m64 -O skcms.ii
during RTL pass: expand
skcms.ii: In function ‘void m()’:
skcms.ii:7:6: internal compiler error: in emit_block_move_hints, at expr.c:1601
    7 | void m() {
      |      ^
0x9a8f4f emit_block_move_hints(rtx_def*, rtx_def*, rtx_def*, block_op_methods, unsigned int, long long, unsigned long long, unsigned long long, unsigned long long)
        /vol/gcc/src/hg/trunk/local/gcc/expr.c:1601
0x9a9043 emit_block_move(rtx_def*, rtx_def*, rtx_def*, block_op_methods)
        /vol/gcc/src/hg/trunk/local/gcc/expr.c:1655
0xe8dd23 emit_partition_copy
        /vol/gcc/src/hg/trunk/local/gcc/tree-outof-ssa.c:226
0xe8dd23 insert_part_to_rtx_on_edge
        /vol/gcc/src/hg/trunk/local/gcc/tree-outof-ssa.c:391
0xe8dd23 elim_create
        /vol/gcc/src/hg/trunk/local/gcc/tree-outof-ssa.c:677
0xe8dd23 eliminate_phi
        /vol/gcc/src/hg/trunk/local/gcc/tree-outof-ssa.c:735
0xe8dd23 expand_phi_nodes(ssaexpand*)
        /vol/gcc/src/hg/trunk/local/gcc/tree-outof-ssa.c:988
0x84bd23 execute
        /vol/gcc/src/hg/trunk/local/gcc/cfgexpand.c:6486

While the original testcase shows the same ICE back to gcc 5, this one also
ICEs on mainline.
Comment 1 Jakub Jelinek 2019-04-18 13:42:59 UTC
I'd say this is a tree-outof-ssa.c bug, in elim_create it calls get_temp_reg on a SSA_NAME which has VECTOR_TYPE with one SFmode element, and as SPARC backend doesn't have V1SFmode, it has BLKmode.  Creating a BLKmode pseudo of course doesn't work too well.
Comment 2 Jakub Jelinek 2019-04-18 13:44:06 UTC
Created attachment 46197 [details]
gcc9-pr90139.patch

Untested fix.
Comment 3 Jakub Jelinek 2019-04-18 13:57:50 UTC
At least on x86_64-linux on the testcase in the patch this started to ICE with r265677, so it is a recent regression.
Comment 4 Jakub Jelinek 2019-04-19 11:58:42 UTC
Author: jakub
Date: Fri Apr 19 11:58:11 2019
New Revision: 270457

URL: https://gcc.gnu.org/viewcvs?rev=270457&root=gcc&view=rev
Log:
	PR middle-end/90139
	* tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return
	assign_temp instead of gen_reg_rtx.

	* gcc.c-torture/compile/pr90139.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr90139.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-outof-ssa.c
Comment 5 Jakub Jelinek 2019-04-19 12:07:55 UTC
Fixed.
Comment 6 Rainer Orth 2019-04-23 12:31:54 UTC
Created attachment 46230 [details]
gcc 7 reduced testcase
Comment 7 Rainer Orth 2019-04-23 12:32:30 UTC
While my original testcase fails on gcc 7, 8, and 9, the one reduced using gcc 9
only failed on trunk.  I've now ran creduce with the original testcase against
both gcc 7 and 8.  Each run produced a different reduced testcase, neither of
which is fixed by applying the trunk patch to the branches.
Comment 8 Rainer Orth 2019-04-23 12:33:04 UTC
Created attachment 46231 [details]
gcc 8 reduced testcase
Comment 9 Rainer Orth 2019-04-23 12:34:14 UTC
Reopening as explained in Comment 7.
Comment 10 Jakub Jelinek 2019-04-23 12:35:25 UTC
That is a 7/8 regression though then.  Or do you have a testcase that still fails on the trunk?
Comment 11 ro@CeBiTec.Uni-Bielefeld.DE 2019-04-23 12:45:04 UTC
> --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> That is a 7/8 regression though then.  Or do you have a testcase that still
> fails on the trunk?

No: it seems the original testcase produces the same ICE in different
places on gcc 7, 8, and 9.

I'm not certain about the regression part, TBH: when I tried the
original (preprocessed) testcase with gcc [876].1.0, it ICEd on all of
them, but it wouldn't even compile on gcc 5.1.0.  So I don't have a gcc
release where it worked.
Comment 12 Jakub Jelinek 2019-05-03 09:16:14 UTC
GCC 9.1 has been released.
Comment 13 Jakub Jelinek 2019-08-12 08:55:19 UTC
GCC 9.2 has been released.
Comment 14 Jakub Jelinek 2019-08-29 14:57:49 UTC
Author: jakub
Date: Thu Aug 29 14:57:18 2019
New Revision: 275035

URL: https://gcc.gnu.org/viewcvs?rev=275035&root=gcc&view=rev
Log:
	Backported from mainline
	2019-04-19  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/90139
	* tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return
	assign_temp instead of gen_reg_rtx.

	* gcc.c-torture/compile/pr90139.c: New test.

Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/pr90139.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
    branches/gcc-8-branch/gcc/tree-outof-ssa.c
Comment 15 Jakub Jelinek 2019-08-30 12:44:35 UTC
Author: jakub
Date: Fri Aug 30 12:44:03 2019
New Revision: 275156

URL: https://gcc.gnu.org/viewcvs?rev=275156&root=gcc&view=rev
Log:
	Backported from mainline
	2019-04-19  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/90139
	* tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return
	assign_temp instead of gen_reg_rtx.

	* gcc.c-torture/compile/pr90139.c: New test.

Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.c-torture/compile/pr90139.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
    branches/gcc-7-branch/gcc/tree-outof-ssa.c
Comment 16 Jakub Jelinek 2019-08-30 13:33:19 UTC
Fixed.