From: Jakub Jelinek Date: Thu, 19 Feb 2009 21:15:12 +0000 (+0100) Subject: re PR target/39175 (ICE while compiling qt-4.5.0-rc1) X-Git-Tag: releases/gcc-4.4.0~490 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=098126222904e77a0e986d46baa99c5f91f53812;p=thirdparty%2Fgcc.git re PR target/39175 (ICE while compiling qt-4.5.0-rc1) PR target/39175 * c-common.c (c_determine_visibility): If visibility changed and DECL_RTL has been already set, call make_decl_rtl to update symbol flags. * decl2.c (determine_visibility): If visibility changed and DECL_RTL has been already set, call make_decl_rtl to update symbol flags. * gcc.dg/visibility-20.c: New test. * g++.dg/ext/visibility/visibility-11.C: New test. From-SVN: r144305 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 84315ee084f3..aea338ebc089 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-02-19 Jakub Jelinek + + PR target/39175 + * c-common.c (c_determine_visibility): If visibility changed and + DECL_RTL has been already set, call make_decl_rtl to update symbol + flags. + 2009-02-19 H.J. Lu PR c++/39188 diff --git a/gcc/c-common.c b/gcc/c-common.c index e7b90674d50a..f19976b4af1c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1,6 +1,7 @@ /* Subroutines shared by all languages that are variants of C. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. This file is part of GCC. @@ -6249,8 +6250,18 @@ c_determine_visibility (tree decl) visibility_specified depending on #pragma GCC visibility. */ if (!DECL_VISIBILITY_SPECIFIED (decl)) { - DECL_VISIBILITY (decl) = default_visibility; - DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma; + if (visibility_options.inpragma + || DECL_VISIBILITY (decl) != default_visibility) + { + DECL_VISIBILITY (decl) = default_visibility; + DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma; + /* If visibility changed and DECL already has DECL_RTL, ensure + symbol flags are updated. */ + if (((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) + || TREE_CODE (decl) == FUNCTION_DECL) + && DECL_RTL_SET_P (decl)) + make_decl_rtl (decl); + } } return false; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c766c7f8057b..00ac24e26937 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-02-19 Jakub Jelinek + + PR target/39175 + * decl2.c (determine_visibility): If visibility changed and + DECL_RTL has been already set, call make_decl_rtl to update symbol + flags. + 2009-02-19 H.J. Lu PR c++/39188 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9d33bbf8bfd9..d57015005b4f 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1,6 +1,6 @@ /* Process declarations and variables for C++ compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) @@ -1922,6 +1922,8 @@ determine_visibility (tree decl) { tree class_type = NULL_TREE; bool use_template; + bool orig_visibility_specified; + enum symbol_visibility orig_visibility; /* Remember that all decls get VISIBILITY_DEFAULT when built. */ @@ -1934,6 +1936,9 @@ determine_visibility (tree decl) maybe_clone_body. */ gcc_assert (!DECL_CLONED_FUNCTION_P (decl)); + orig_visibility_specified = DECL_VISIBILITY_SPECIFIED (decl); + orig_visibility = DECL_VISIBILITY (decl); + if (TREE_CODE (decl) == TYPE_DECL) { if (CLASS_TYPE_P (TREE_TYPE (decl))) @@ -2062,6 +2067,15 @@ determine_visibility (tree decl) || ! DECL_VISIBILITY_SPECIFIED (decl)) constrain_visibility (decl, tvis); } + + /* If visibility changed and DECL already has DECL_RTL, ensure + symbol flags are updated. */ + if ((DECL_VISIBILITY (decl) != orig_visibility + || DECL_VISIBILITY_SPECIFIED (decl) != orig_visibility_specified) + && ((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) + || TREE_CODE (decl) == FUNCTION_DECL) + && DECL_RTL_SET_P (decl)) + make_decl_rtl (decl); } /* By default, static data members and function members receive diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a84d1f667017..b8a1c038831d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-02-19 Jakub Jelinek + + PR target/39175 + * gcc.dg/visibility-20.c: New test. + * g++.dg/ext/visibility/visibility-11.C: New test. + 2009-02-19 H.J. Lu PR c++/39188 diff --git a/gcc/testsuite/g++.dg/ext/visibility/visibility-11.C b/gcc/testsuite/g++.dg/ext/visibility/visibility-11.C new file mode 100644 index 000000000000..78f40c62b8ba --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/visibility/visibility-11.C @@ -0,0 +1,18 @@ +// PR target/39175 +// { dg-do compile } +// { dg-require-visibility "" } +// { dg-options "-O2 -fvisibility=hidden -fpic" { target fpic } } + +__attribute__((noinline)) int +foo (int x) +{ + return x; +} + +int foo (int x); + +int +bar (int x) +{ + return foo (x); +} diff --git a/gcc/testsuite/gcc.dg/visibility-20.c b/gcc/testsuite/gcc.dg/visibility-20.c new file mode 100644 index 000000000000..5fc7447f0deb --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-20.c @@ -0,0 +1,18 @@ +/* PR target/39175 */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-options "-O2 -fvisibility=hidden -fpic" { target fpic } } */ + +__attribute__((noinline)) int +foo (int x) +{ + return x; +} + +int foo (int x); + +int +bar (int x) +{ + return foo (x); +}