]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/54409 (internal compiler error: in remap_predicate, at ipa-inline...
authorMartin Jambor <mjambor@suse.cz>
Fri, 31 Aug 2012 14:05:45 +0000 (16:05 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Fri, 31 Aug 2012 14:05:45 +0000 (16:05 +0200)
2012-08-31  Martin Jambor  <mjambor@suse.cz>

PR middle-end/54409
* ipa-inline-analysis.c (remap_predicate): Fix the offset_map
checking condition.

* gcc/testsuite/gcc.dg/torture/pr54409.c: New test.

From-SVN: r190833

gcc/ChangeLog
gcc/ipa-inline-analysis.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr54409.c [new file with mode: 0644]

index 1797ff6e7f9bf0f76fd4dd7249135b3af190c499..4f55c42cc033d9c47e2dda5fb3a72032d27c095f 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-31  Martin Jambor  <mjambor@suse.cz>
+
+       PR middle-end/54409
+       * ipa-inline-analysis.c (remap_predicate): Fix the offset_map
+       checking condition.
+
 2012-08-31  Martin Jambor  <mjambor@suse.cz>
 
        * ipa-inline-analysis.c (phi_result_unknown_predicate): New function.
index 6da256a614c625e521bfba03367cf005b445cb71..5b31b6d8c605f277aad50d63980442fee07d0983 100644 (file)
@@ -2811,8 +2811,11 @@ remap_predicate (struct inline_summary *info,
                 if (!operand_map
                     || (int)VEC_length (int, operand_map) <= c->operand_num
                     || VEC_index (int, operand_map, c->operand_num) == -1
-                    || (!c->agg_contents
-                        && VEC_index (int, offset_map, c->operand_num) != 0)
+                    /* TODO: For non-aggregate conditions, adding an offset is
+                       basically an arithmetic jump function processing which
+                       we should support in future.  */
+                    || ((!c->agg_contents || !c->by_ref)
+                        && VEC_index (int, offset_map, c->operand_num) > 0)
                     || (c->agg_contents && c->by_ref
                         && VEC_index (int, offset_map, c->operand_num) < 0))
                   cond_predicate = true_predicate ();
index 937ba1a2f0b21b459bbd5d4dbf4a1641aba5b6da..b8d48f8d3714ed0c62150ec4fceeb7839e7a05c4 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-31  Martin Jambor  <mjambor@suse.cz>
+
+       PR middle-end/54409
+       * gcc.dg/torture/pr54409.c: New test.
+
 2012-08-31  Martin Jambor  <mjambor@suse.cz>
 
        * gfortran.dg/pr48636.f90: Add dump scan checks.
diff --git a/gcc/testsuite/gcc.dg/torture/pr54409.c b/gcc/testsuite/gcc.dg/torture/pr54409.c
new file mode 100644 (file)
index 0000000..c759547
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+
+int b;
+
+struct S
+{
+  char *p;
+  struct {
+  } s;
+  int a;
+};
+
+static _Bool
+fn2 (int *p1)
+{
+  if (b)
+    {
+      struct S *c = (struct S *) &p1;
+      return c->a;
+    }
+}
+
+_Bool
+fn3 (struct S *p1)
+{
+  if (fn2 ((int *) &p1->s))
+    return 0;
+}