aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2012-08-31 16:05:45 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2012-08-31 16:05:45 +0200
commit0336096575e3cf4dd0ac43d65097976631c609df (patch)
tree602afe45f5e892491199bff66bc6cf3c3be7a5f6 /gcc
parent48679f6e244fdfb273d669ff02095ef0ffe3265f (diff)
downloadgcc-0336096575e3cf4dd0ac43d65097976631c609df.zip
gcc-0336096575e3cf4dd0ac43d65097976631c609df.tar.gz
gcc-0336096575e3cf4dd0ac43d65097976631c609df.tar.bz2
re PR middle-end/54409 (internal compiler error: in remap_predicate, at ipa-inline-analysis.c:2710)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-inline-analysis.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr54409.c28
4 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1797ff6..4f55c42 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
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.
(predicate_for_phi_result): Likewise.
(estimate_function_body_sizes): Use the above two functions.
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 6da256a..5b31b6d 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -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 ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 937ba1a..b8d48f8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
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.
2012-08-29 Richard Sandiford <rdsandiford@googlemail.com>
diff --git a/gcc/testsuite/gcc.dg/torture/pr54409.c b/gcc/testsuite/gcc.dg/torture/pr54409.c
new file mode 100644
index 0000000..c759547
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr54409.c
@@ -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;
+}