This commit is contained in:
Jakub Jelinek 2007-10-01 21:32:51 +00:00
parent 44d66d10ce
commit f7b32afe54
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,65 @@
2007-10-01 Alexandre Oliva <aoliva@redhat.com>
* decl.c (duplicate_decls): Preserve linkage flags for mere
redeclarations of gnu_inline definitions.
* g++.dg/ext/gnu-inline-global-redecl.C: New.
--- gcc/cp/decl.c.orig 2007-09-28 00:02:33.000000000 -0300
+++ gcc/cp/decl.c 2007-10-01 16:33:10.000000000 -0300
@@ -1846,24 +1846,24 @@ duplicate_decls (tree newdecl, tree oldd
new_template = NULL_TREE;
if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl))
{
- bool old_decl_gnu_inline;
+ bool new_redefines_gnu_inline = false;
- if ((DECL_INTERFACE_KNOWN (olddecl)
- && TREE_CODE (olddecl) == FUNCTION_DECL)
- || (TREE_CODE (olddecl) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL))
+ if (new_defines_function
+ && ((DECL_INTERFACE_KNOWN (olddecl)
+ && TREE_CODE (olddecl) == FUNCTION_DECL)
+ || (TREE_CODE (olddecl) == TEMPLATE_DECL
+ && (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl))
+ == FUNCTION_DECL))))
{
tree fn = olddecl;
if (TREE_CODE (fn) == TEMPLATE_DECL)
fn = DECL_TEMPLATE_RESULT (olddecl);
- old_decl_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn);
+ new_redefines_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn);
}
- else
- old_decl_gnu_inline = false;
- if (!old_decl_gnu_inline)
+ if (!new_redefines_gnu_inline)
{
DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
--- gcc/testsuite/g++.dg/ext/gnu-inline-global-redecl.C 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/g++.dg/ext/gnu-inline-global-redecl.C 2007-10-01 16:45:49.000000000 -0300
@@ -0,0 +1,19 @@
+/* Test __attribute__((gnu_inline)).
+
+ Check that we don't get out-of-line definitions for extern inline
+ gnu_inline functions, regardless of redeclaration.
+
+ */
+
+/* { dg-do link } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+
+#include "gnu-inline-common.h"
+
+decl(extern, fn)
+gnuindef(fn, 0)
+decl(extern, fn)
+
+int main () {
+ fn ();
+}

View File

@ -1,6 +1,6 @@
%define DATE 20070925
%define gcc_version 4.1.2
%define gcc_release 29
%define gcc_release 30
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%define include_gappletviewer 1
@ -146,6 +146,7 @@ Patch29: gcc41-jdwp.patch
Patch30: gcc41-pr20880.patch
Patch31: gcc41-pr32694.patch
Patch32: gcc41-virtual-inline-backtrace.patch
Patch33: gcc41-c++-gnu-inline-redecl.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
@ -461,6 +462,7 @@ which are required to run programs compiled with the GNAT.
%patch30 -p0 -b .pr20880~
%patch31 -p0 -b .pr32694~
%patch32 -p0 -b .virtual-inline-backtrace~
%patch33 -p0 -b .c++-gnu-inline-redecl~
sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@ -1615,6 +1617,10 @@ fi
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
* Mon Oct 1 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-30
- fix ICE on C++ gnu_inline function followed by prototype of the same
fn (Alexandre Oliva)
* Fri Sep 28 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-29
- print virtual inline backtrace in some diagnostic messages to help
locate bugs reported with -D_FORTIFY_SOURCE{,=2}