From: Jan Hubicka Date: Wed, 13 Nov 2019 13:29:27 +0000 (+0100) Subject: ipa-inline.c (ipa_inline): Check that function is defined before flattening. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2895b172d56c355373b64517a3298a01a2f10ec0;p=gcc.git ipa-inline.c (ipa_inline): Check that function is defined before flattening. * ipa-inline.c (ipa_inline): Check that function is defined before flattening. * gcc.c-torture/compile/flatten.c: New testcase. From-SVN: r278139 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e5560e1f87..f637442f523 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-11-13 Jan Hubicka + + * ipa-inline.c (ipa_inline): Check that function is defined before + flattening. + 2019-11-13 Andrew Stubbs Julian Brown diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index df6f991ad79..f3e880c3e93 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2564,8 +2564,9 @@ ipa_inline (void) for (i = nnodes - 1, j = i; i >= 0; i--) { node = order[i]; - if (lookup_attribute ("flatten", - DECL_ATTRIBUTES (node->decl)) != NULL) + if (node->definition + && lookup_attribute ("flatten", + DECL_ATTRIBUTES (node->decl)) != NULL) order[j--] = order[i]; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1727bf0eac7..cd38237ab3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-11-13 Jan Hubicka + + * gcc.c-torture/compile/flatten.c: New testcase. + 2019-11-13 Tobias Burnus PR fortran/92470 diff --git a/gcc/testsuite/gcc.c-torture/compile/flatten.c b/gcc/testsuite/gcc.c-torture/compile/flatten.c new file mode 100644 index 00000000000..73042bed64a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/flatten.c @@ -0,0 +1,5 @@ +int you_shall_not_flatten_me () __attribute__ ((flatten)); +main() +{ + you_shall_not_flatten_me (); +}