Commit 0107dca2 by Richard Biener Committed by Richard Biener

re PR middle-end/57147 (setjmp call and if body wrongly elided (function runs off early end))

2013-05-06  Richard Biener  <rguenther@suse.de>

	PR middle-end/57147
	* tree-cfg.c (gimple_purge_dead_abnormal_call_edges): If
	the edge is also fallthru, preserve it and just clear the
	abnormal flag.
	* tree-cfgcleanup.c (remove_fallthru_edge): If the edge is
	also complex, preserve that and just clear the fallthru flag.
	* tree-inline.c (update_ssa_across_abnormal_edges): Also
	update virtual operands.

	* gcc.dg/torture/pr57147-1.c: New testcase.
	* gcc.dg/torture/pr57147-2.c: Likewise.
	* gcc.dg/torture/pr57147-3.c: Likewise.

From-SVN: r198625
parent e5123d08
2013-05-06 Richard Biener <rguenther@suse.de>
PR middle-end/57147
* tree-cfg.c (gimple_purge_dead_abnormal_call_edges): If
the edge is also fallthru, preserve it and just clear the
abnormal flag.
* tree-cfgcleanup.c (remove_fallthru_edge): If the edge is
also complex, preserve that and just clear the fallthru flag.
* tree-inline.c (update_ssa_across_abnormal_edges): Also
update virtual operands.
2013-05-06 Alan Modra <amodra@gmail.com>
* config/rs6000/linux.h (DEFAULT_ASM_ENDIAN): Define.
......
2013-05-06 Richard Biener <rguenther@suse.de>
PR middle-end/57147
* gcc.dg/torture/pr57147-1.c: New testcase.
* gcc.dg/torture/pr57147-2.c: Likewise.
* gcc.dg/torture/pr57147-3.c: Likewise.
2013-05-06 Oleg Endo <olegendo@gcc.gnu.org>
PR target/55303
......
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
struct __jmp_buf_tag {};
typedef struct __jmp_buf_tag jmp_buf[1];
extern int _setjmp (struct __jmp_buf_tag __env[1]);
jmp_buf g_return_jmp_buf;
void SetNaClSwitchExpectations (void)
{
}
void TestSyscall(void)
{
SetNaClSwitchExpectations();
_setjmp (g_return_jmp_buf);
}
/* { dg-final { scan-tree-dump-not "builtin_unreachable" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
struct __jmp_buf_tag {};
typedef struct __jmp_buf_tag jmp_buf[1];
extern int _setjmp (struct __jmp_buf_tag __env[1]);
jmp_buf g_return_jmp_buf;
void SetNaClSwitchExpectations (void)
{
__builtin_longjmp (g_return_jmp_buf, 1);
}
void TestSyscall(void)
{
SetNaClSwitchExpectations();
_setjmp (g_return_jmp_buf);
}
/* { dg-final { scan-tree-dump "setjmp" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
typedef char * ptr_t;
struct __jmp_buf_tag {
};
typedef struct __jmp_buf_tag sigjmp_buf[1];
sigjmp_buf GC_jmp_buf;
void GC_fault_handler(int sig)
{
}
void GC_setup_temporary_fault_handler() {
GC_set_and_save_fault_handler(GC_fault_handler);
}
ptr_t GC_find_limit(ptr_t p)
{
GC_setup_temporary_fault_handler();
if (__sigsetjmp (GC_jmp_buf, 1) == 0)
for (;;)
;
}
......@@ -7628,7 +7628,10 @@ gimple_purge_dead_abnormal_call_edges (basic_block bb)
{
if (e->flags & EDGE_ABNORMAL)
{
remove_edge_and_dominated_blocks (e);
if (e->flags & EDGE_FALLTHRU)
e->flags &= ~EDGE_ABNORMAL;
else
remove_edge_and_dominated_blocks (e);
changed = true;
}
else
......
......@@ -57,7 +57,10 @@ remove_fallthru_edge (vec<edge, va_gc> *ev)
FOR_EACH_EDGE (e, ei, ev)
if ((e->flags & EDGE_FALLTHRU) != 0)
{
remove_edge_and_dominated_blocks (e);
if (e->flags & EDGE_COMPLEX)
e->flags &= ~EDGE_FALLTHRU;
else
remove_edge_and_dominated_blocks (e);
return true;
}
return false;
......
......@@ -1841,14 +1841,8 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
gcc_assert ((e->flags & EDGE_EH)
|| SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi)));
if (virtual_operand_p (PHI_RESULT (phi)))
{
mark_virtual_operands_for_renaming (cfun);
continue;
}
re = find_edge (ret_bb, e->dest);
gcc_assert (re);
gcc_checking_assert (re);
gcc_assert ((re->flags & (EDGE_EH | EDGE_ABNORMAL))
== (e->flags & (EDGE_EH | EDGE_ABNORMAL)));
......
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