Commit 6a16e934 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/37879 (ICE with "wrong" use of noreturn attribute and optimization)

	PR tree-optimization/37879
	* predict.c (tree_estimate_probability): Check if last_stmt is
	non-NULL before dereferencing it.

	* gcc.dg/pr37879.c: New test.

From-SVN: r141390
parent 8f0f2a1d
2008-10-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37879
* predict.c (tree_estimate_probability): Check if last_stmt is
non-NULL before dereferencing it.
2008-10-27 Vladimir Makarov <vmakarov@redhat.com> 2008-10-27 Vladimir Makarov <vmakarov@redhat.com>
* ira-int.h (ira_allocno): Add member updated_cover_class_cost. * ira-int.h (ira_allocno): Add member updated_cover_class_cost.
......
...@@ -1599,6 +1599,7 @@ tree_estimate_probability (void) ...@@ -1599,6 +1599,7 @@ tree_estimate_probability (void)
{ {
edge e; edge e;
edge_iterator ei; edge_iterator ei;
gimple last;
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
{ {
...@@ -1621,7 +1622,8 @@ tree_estimate_probability (void) ...@@ -1621,7 +1622,8 @@ tree_estimate_probability (void)
&& e->dest != EXIT_BLOCK_PTR && e->dest != EXIT_BLOCK_PTR
&& single_succ_p (e->dest) && single_succ_p (e->dest)
&& single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR && single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR
&& gimple_code (last_stmt (e->dest)) == GIMPLE_RETURN) && (last = last_stmt (e->dest)) != NULL
&& gimple_code (last) == GIMPLE_RETURN)
{ {
edge e1; edge e1;
edge_iterator ei1; edge_iterator ei1;
......
2008-10-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37879
* gcc.dg/pr37879.c: New test.
2008-10-24 Michael Meissner <meissner@linux.vnet.ibm.com> 2008-10-24 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/37841 PR target/37841
......
/* PR tree-optimization/37879 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
static inline void bar (int) __attribute__ ((noreturn));
void baz () __attribute__ ((noreturn));
inline int
foo (int i)
{
return i;
}
int i = 23;
static inline void
bar (int j)
{
if (j)
asm ("");
} /* { dg-warning "does return" } */
void
baz ()
{
int j;
bar (foo (j = i++));
asm ("");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment