From 9e25209f3a29dd1c8ee33c848a6a2b66e4c06d48 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 16 Mar 2015 10:26:28 +0000 Subject: [PATCH] re PR middle-end/65409 (ICE in store_field) PR middle-end/65409 * expr.c (store_field): Do not do a direct block copy if the source is a PARALLEL with BLKmode. From-SVN: r221453 --- gcc/ChangeLog | 6 ++++++ gcc/expr.c | 11 ++++++----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/pr65049.C | 19 +++++++++++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr65049.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1348db5a01f..b17168e8774 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-03-16 Eric Botcazou + + PR middle-end/65409 + * expr.c (store_field): Do not do a direct block copy if the source is + a PARALLEL with BLKmode. + 2015-03-16 Tom de Vries PR middle-end/65414 diff --git a/gcc/expr.c b/gcc/expr.c index 89ca12945ff..dc13a14f4e7 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6645,11 +6645,12 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos, && mode != TYPE_MODE (TREE_TYPE (exp))) temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1); - /* If the modes of TEMP and TARGET are both BLKmode, both - must be in memory and BITPOS must be aligned on a byte - boundary. If so, we simply do a block copy. Likewise - for a BLKmode-like TARGET. */ - if (GET_MODE (temp) == BLKmode + /* If TEMP is not a PARALLEL (see below) and its mode and that of TARGET + are both BLKmode, both must be in memory and BITPOS must be aligned + on a byte boundary. If so, we simply do a block copy. Likewise for + a BLKmode-like TARGET. */ + if (GET_CODE (temp) != PARALLEL + && GET_MODE (temp) == BLKmode && (GET_MODE (target) == BLKmode || (MEM_P (target) && GET_MODE_CLASS (GET_MODE (target)) == MODE_INT diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96f81d107ca..edfdf6bd28f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-16 Eric Botcazou + + * testsuite/g++.dg/pr65049.C: New test. + 2015-03-16 Tom de Vries * gcc.target/i386/fuse-caller-save-rec.c: Add PR64895 xfail on scans. diff --git a/gcc/testsuite/g++.dg/pr65049.C b/gcc/testsuite/g++.dg/pr65049.C new file mode 100644 index 00000000000..7ced500a6f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr65049.C @@ -0,0 +1,19 @@ +// PR middle-end/65409 +// Reported by Ignacy Gawedzki + +struct Foo +{ + Foo() {} + int a; + int b; + char c; +}; + +Foo copy_foo(Foo); + +struct Bar : Foo +{ + Bar(Foo t) : Foo(copy_foo(t)) {} +}; + +Bar a = Foo(); -- 2.30.2