From: rguenth Date: Thu, 10 Dec 2015 09:05:58 +0000 (+0000) Subject: 2015-12-10 Richard Biener X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bca33fb84e4b076ce651b0183d8ca6649d571bf1;p=thirdparty%2Fgcc.git 2015-12-10 Richard Biener PR ipa/68721 * ipa-split.c (split_function): Record return value properly when the split part doesn't set it. * gcc.dg/torture/pr68721.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231494 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c990fc3fc667..b5ee0be9a537 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-12-10 Richard Biener + + PR ipa/68721 + * ipa-split.c (split_function): Record return value properly + when the split part doesn't set it. + 2015-12-10 Richard Biener PR tree-optimization/68806 diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 56c954b01b26..f77ab52161de 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1281,7 +1281,7 @@ split_function (basic_block return_bb, struct split_point *split_point, to return void instead of just outputting function with undefined return value. For structures this affects quality of codegen. */ else if (!split_point->split_part_set_retval - && find_retval (return_bb)) + && (retval = find_retval (return_bb))) { bool redirected = true; basic_block new_return_bb = create_basic_block (NULL, 0, return_bb); @@ -1305,6 +1305,7 @@ split_function (basic_block return_bb, struct split_point *split_point, e->count = new_return_bb->count; add_bb_to_loop (new_return_bb, current_loops->tree_root); bitmap_set_bit (split_point->split_bbs, new_return_bb->index); + retbnd = find_retbnd (return_bb); } /* When we pass around the value, use existing return block. */ else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a24de4266cd0..7ac1418b9b8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-10 Richard Biener + + PR ipa/68721 + * gcc.dg/torture/pr68721.c: New testcase. + 2015-12-10 Richard Biener PR tree-optimization/68806 diff --git a/gcc/testsuite/gcc.dg/torture/pr68721.c b/gcc/testsuite/gcc.dg/torture/pr68721.c new file mode 100644 index 000000000000..297adabc8ba9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68721.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +extern void abort (void); + +int a, b, c, *d, **e = &d; + +int * +fn1 () +{ + for (;;) + { + for (; a;) + if (b) + abort (); + break; + } + for (; c;) + ; + return &a; +} + +int +main () +{ + *e = fn1 (); + + if (!d) + abort (); + + return 0; +}