re PR middle-end/44974 (Function with attribute noreturn omits a call to another function with noreturn)

PR middle-end/44974
	* builtins.c (expand_builtin): Don't optimize away
	calls to DECL_LOOPING_CONST_OR_PURE_P builtins.

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

From-SVN: r163415
This commit is contained in:
Jakub Jelinek 2010-08-20 20:49:46 +02:00 committed by Jakub Jelinek
parent 6c33409079
commit 994fc9abdd
4 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-08-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/44974
* builtins.c (expand_builtin): Don't optimize away
calls to DECL_LOOPING_CONST_OR_PURE_P builtins.
2010-08-20 Uros Bizjak <ubizjak@gmail.com> 2010-08-20 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (ashift RSP splitter): Remove splitter. * config/i386/i386.md (ashift RSP splitter): Remove splitter.

View File

@ -5770,7 +5770,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
none of its arguments are volatile, we can avoid expanding the none of its arguments are volatile, we can avoid expanding the
built-in call and just evaluate the arguments for side-effects. */ built-in call and just evaluate the arguments for side-effects. */
if (target == const0_rtx if (target == const0_rtx
&& (DECL_PURE_P (fndecl) || TREE_READONLY (fndecl))) && (DECL_PURE_P (fndecl) || TREE_READONLY (fndecl))
&& !DECL_LOOPING_CONST_OR_PURE_P (fndecl))
{ {
bool volatilep = false; bool volatilep = false;
tree arg; tree arg;

View File

@ -1,5 +1,8 @@
2010-08-20 Jakub Jelinek <jakub@redhat.com> 2010-08-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/44974
* gcc.dg/pr44974.c: New test.
PR rtl-optimization/45353 PR rtl-optimization/45353
* gcc.dg/pr45353.c: New test. * gcc.dg/pr45353.c: New test.

View File

@ -0,0 +1,23 @@
/* PR middle-end/44974 */
/* { dg-do compile } */
/* { dg-options "-O -fno-optimize-sibling-calls" } */
extern void foo (int status) __attribute__ ((__noreturn__));
extern void bar (int status) __attribute__ ((__noreturn__));
extern void _Exit (int status) __attribute__ ((__noreturn__));
void
foo (int status)
{
_Exit (status);
}
void
_Exit (int status)
{
bar (status);
}
/* { dg-final { scan-assembler "call\[^\n\]*_Exit" { target i?86-*-* x86_64-*-* ia64-*-* sparc*-*-* } } } */
/* { dg-final { scan-assembler "bl\[^\n\]*_Exit" { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler "brasl\[^\n\]*_Exit" { target { s390*-*-* && lp64 } } } } */