From: Jakub Jelinek Date: Wed, 21 Nov 2001 11:09:01 +0000 (+0100) Subject: c-decl.c (c_expand_deferred_function): Only call c_expand_body if fndecl is still... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=83dea45d59b06dc8d99c78e471f97957c54105eb;p=gcc.git c-decl.c (c_expand_deferred_function): Only call c_expand_body if fndecl is still DECL_INLINE and has DECL_RESULT. * c-decl.c (c_expand_deferred_function): Only call c_expand_body if fndecl is still DECL_INLINE and has DECL_RESULT. * gcc.c-torture/compile/20011119-1.c: New test. * gcc.c-torture/compile/20011119-2.c: New test. From-SVN: r47240 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ce39fc3ae0..11eaaa81dd7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-21 Jakub Jelinek + + * c-decl.c (c_expand_deferred_function): Only call c_expand_body + if fndecl is still DECL_INLINE and has DECL_RESULT. + 2001-11-20 Kaveh R. Ghazi * clipper.c (clipper_movstr): Avoid uninitialized warning. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4d7ca2b8936..f7651c0ed29 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6768,8 +6768,13 @@ void c_expand_deferred_function (fndecl) tree fndecl; { - c_expand_body (fndecl, 0, 0); - current_function_decl = NULL; + /* DECL_INLINE or DECL_RESULT might got cleared after the inline + function was deferred, e.g. in duplicate_decls. */ + if (DECL_INLINE (fndecl) && DECL_RESULT (fndecl)) + { + c_expand_body (fndecl, 0, 0); + current_function_decl = NULL; + } } /* Generate the RTL for the body of FNDECL. If NESTED_P is non-zero, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b593ca68fc..64e2664ef71 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-11-20 Jakub Jelinek + + * gcc.c-torture/compile/20011119-1.c: New test. + * gcc.c-torture/compile/20011119-2.c: New test. + 2001-11-17 Aldy Hernandez * gcc.dg/altivec-1.c: Fix typo. diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c new file mode 100644 index 00000000000..02dfcdbc0b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c @@ -0,0 +1,5 @@ +extern inline int foo (void) +{ + return 23; +} +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c new file mode 100644 index 00000000000..2616368a1ce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c @@ -0,0 +1,13 @@ +extern inline int foo (void) +{ + return 23; +} +int bar (void) +{ + return foo (); +} +extern int foo (void) __attribute__ ((weak, alias ("xxx"))); +int baz (void) +{ + return foo (); +}