From 0336096575e3cf4dd0ac43d65097976631c609df Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 31 Aug 2012 16:05:45 +0200 Subject: [PATCH] re PR middle-end/54409 (internal compiler error: in remap_predicate, at ipa-inline-analysis.c:2710) 2012-08-31 Martin Jambor 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 | 6 ++++++ gcc/ipa-inline-analysis.c | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr54409.c | 28 ++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr54409.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1797ff6e7f9..4f55c42cc03 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-08-31 Martin Jambor + + PR middle-end/54409 + * ipa-inline-analysis.c (remap_predicate): Fix the offset_map + checking condition. + 2012-08-31 Martin Jambor * ipa-inline-analysis.c (phi_result_unknown_predicate): New function. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 6da256a614c..5b31b6d8c60 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 937ba1a2f0b..b8d48f8d371 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-08-31 Martin Jambor + + PR middle-end/54409 + * gcc.dg/torture/pr54409.c: New test. + 2012-08-31 Martin Jambor * 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 index 00000000000..c7595474f5c --- /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; +} -- 2.30.2