This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix var-tracking ICE introduced in poly_int conversion (PR debug/84252)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, Richard Sandiford <richard dot sandiford at arm dot com>, Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Feb 2018 23:43:25 +0100
- Subject: [PATCH] Fix var-tracking ICE introduced in poly_int conversion (PR debug/84252)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As mentioned in the PR, the vt_get_decl_and_offset function verifies
incoming PARALLEL is usable for tracking, but if it fails, we retry
vt_get_decl_and_offset on DECL_RTL and there we check only that a memory
isn't larger than 16 bytes (to make sure it doesn't have more than 16
parts), but if DECL_RTL is a REG e.g. with OImode as in the testcase on
aarch64, we just go on. For the OImode argument passed in V4SImode v0
and V4SImode v1 parts we are lucky and used to get away with it, as it only
had 2 parts (and only dwarf2out threw it away as we can't really do vector
debug info well right now), but generally if vt_get_decl_and_offset doesn't
check the PARALLEL incoming, it is better to punt right away, we don't know
if all PARALLEL operands are REGs, have REG_ATTRS, the same underlying decl
and usable offsets, which we all rely on and only vt_get_decl_and_offset
verifies.
Bootstrapped/regtested on x86_64-linux and i686-linux and Richard S. tested
it on aarch64-linux, ok for trunk?
2018-02-07 Jakub Jelinek <jakub@redhat.com>
PR debug/84252
* var-tracking.c (vt_add_function_parameter): Punt for non-onepart
PARALLEL incoming that failed vt_get_decl_and_offset check.
* gcc.target/aarch64/pr84252.c: New test.
--- gcc/var-tracking.c.jj 2018-01-04 00:43:15.007702432 +0100
+++ gcc/var-tracking.c 2018-02-07 12:47:09.735980882 +0100
@@ -9653,6 +9653,7 @@ vt_add_function_parameter (tree parm)
poly_int64 offset;
dataflow_set *out;
decl_or_value dv;
+ bool incoming_ok = true;
if (TREE_CODE (parm) != PARM_DECL)
return;
@@ -9743,6 +9744,7 @@ vt_add_function_parameter (tree parm)
if (!vt_get_decl_and_offset (incoming, &decl, &offset))
{
+ incoming_ok = false;
if (MEM_P (incoming))
{
/* This means argument is passed by invisible reference. */
@@ -9861,6 +9863,10 @@ vt_add_function_parameter (tree parm)
{
int i;
+ /* The following code relies on vt_get_decl_and_offset returning true for
+ incoming, which might not be always the case. */
+ if (!incoming_ok)
+ return;
for (i = 0; i < XVECLEN (incoming, 0); i++)
{
rtx reg = XEXP (XVECEXP (incoming, 0, i), 0);
--- gcc/testsuite/gcc.target/aarch64/pr84252.c.jj 2018-02-07 14:01:27.987436160 +0100
+++ gcc/testsuite/gcc.target/aarch64/pr84252.c 2018-02-07 13:59:47.736644299 +0100
@@ -0,0 +1,10 @@
+/* PR debug/84252 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+struct S { __Int32x4_t b[2]; };
+
+void
+foo (struct S x)
+{
+}
Jakub