Bug 78643 - [6 Regression] ICE in convert_move, at expr.c:230
Summary: [6 Regression] ICE in convert_move, at expr.c:230
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P2 normal
Target Milestone: 6.5
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-12-02 11:30 UTC by Matthias Klose
Modified: 2018-06-25 18:02 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail: 5.4.1, 6.2.1, 7.0, 8.0
Last reconfirmed: 2017-08-09 00:00:00


Attachments
test case (762 bytes, text/x-csrc)
2016-12-02 11:30 UTC, Matthias Klose
Details
gcc8-pr80583.patch (717 bytes, patch)
2017-12-01 10:48 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2016-12-02 11:30:42 UTC
Created attachment 40223 [details]
test case

seen on trunk, 6 and 5 branches on x86_64-linux-gnu, works with -O1 and up:

$ g++ -c -O0 main.cpp
main.cpp: In function 'void p(AV)':
main.cpp:80:6: note: The ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
 void p(union AV a) {
      ^
main.cpp: In function 'void test(AV, int)':
main.cpp:101:29: internal compiler error: in convert_move, at expr.c:230
     r.av = _mm256_shift_left(a.av,n);
            ~~~~~~~~~~~~~~~~~^~~~~~~~
0x898da0 convert_move(rtx_def*, rtx_def*, int)
        ../../src/gcc/expr.c:230
0x89f5cb store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool, tree_node*)
        ../../src/gcc/expr.c:5628
0x89fa3e expand_assignment(tree_node*, tree_node*, bool)
        ../../src/gcc/expr.c:5320
0x7b3dcd expand_gimple_stmt_1
        ../../src/gcc/cfgexpand.c:3641
0x7b3dcd expand_gimple_stmt
        ../../src/gcc/cfgexpand.c:3737
0x7b538f expand_gimple_basic_block
        ../../src/gcc/cfgexpand.c:5744
0x7ba596 execute
        ../../src/gcc/cfgexpand.c:6358
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Martin Liška 2017-08-09 13:47:16 UTC
Confirmed, started with r220609.https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78643#
Comment 2 Jakub Jelinek 2017-08-30 00:09:51 UTC
I think the problem is that while TYPE_MODE has the hacks for vector types (vector_type_mode call), DECL_MODE doesn't have something similar.
We have some hacks for this here and there.
Comment 3 Jakub Jelinek 2017-08-30 00:33:18 UTC
E.g. the following untested patch fixes it (or we could do it in the callers):
--- gcc/expr.c.jj	2017-08-29 19:03:09.000000000 +0200
+++ gcc/expr.c	2017-08-30 02:09:33.150618229 +0200
@@ -7010,7 +7010,11 @@ get_inner_reference (tree exp, HOST_WIDE
 	     size.  */
 	mode = TYPE_MODE (DECL_BIT_FIELD_TYPE (field));
       else if (!DECL_BIT_FIELD (field))
-	mode = DECL_MODE (field);
+	{
+	  mode = DECL_MODE (field);
+	  if (mode == BLKmode && VECTOR_TYPE_P (TREE_TYPE (exp)))
+	    mode = TYPE_MODE (TREE_TYPE (exp));
+	}
       else if (DECL_MODE (field) == BLKmode)
 	blkmode_bitfield = true;
Comment 4 Jakub Jelinek 2017-10-10 13:25:58 UTC
GCC 5 branch is being closed
Comment 5 Jakub Jelinek 2017-12-01 10:48:14 UTC
Created attachment 42764 [details]
gcc8-pr80583.patch

Untested fix.
Comment 6 Jakub Jelinek 2017-12-02 07:55:19 UTC
Author: jakub
Date: Sat Dec  2 07:54:47 2017
New Revision: 255353

URL: https://gcc.gnu.org/viewcvs?rev=255353&root=gcc&view=rev
Log:
	PR target/78643
	PR target/80583
	* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
	is BLKmode for vector field with vector raw mode, use TYPE_MODE
	instead of DECL_MODE.

	* gcc.target/i386/pr80583.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr80583.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expr.c
    trunk/gcc/testsuite/ChangeLog
Comment 7 Jakub Jelinek 2017-12-02 08:01:42 UTC
Fixed on the trunk so far.
Comment 8 Jakub Jelinek 2017-12-15 22:09:39 UTC
Author: jakub
Date: Fri Dec 15 22:09:07 2017
New Revision: 255721

URL: https://gcc.gnu.org/viewcvs?rev=255721&root=gcc&view=rev
Log:
	Backported from mainline
	2017-12-02  Jakub Jelinek  <jakub@redhat.com>

	PR target/78643
	PR target/80583
	* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
	is BLKmode for vector field with vector raw mode, use TYPE_MODE
	instead of DECL_MODE.

	* gcc.target/i386/pr80583.c: New test.

Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/pr80583.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/expr.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
Comment 9 Jakub Jelinek 2017-12-16 08:58:06 UTC
Fixed for 7.3+ too.
Comment 10 Jakub Jelinek 2018-06-25 16:57:46 UTC
Author: jakub
Date: Mon Jun 25 16:57:13 2018
New Revision: 262041

URL: https://gcc.gnu.org/viewcvs?rev=262041&root=gcc&view=rev
Log:
	Backported from mainline
	2017-12-02  Jakub Jelinek  <jakub@redhat.com>

	PR target/78643
	PR target/80583
	* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
	is BLKmode for vector field with vector raw mode, use TYPE_MODE
	instead of DECL_MODE.

	* gcc.target/i386/pr80583.c: New test.

Added:
    branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr80583.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/expr.c
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
Comment 11 Jakub Jelinek 2018-06-25 18:02:48 UTC
Fixed for 6.5.