re PR c++/9738 ([mingw] Internal compiler error in rest_of_compilation, at toplev.c: 3491)
PR c++/9738 * config/i386/winnt.c (i386_pe_encode_section_info): Enable even if not first. * cp/decl.c (duplicate_decls): Re-invoke make_decl_rtl if the old decl had instantiated DECL_RTL. (Base on Richard Henderson 2003-05-13 patch to c-decl.c). * testsuite/g++.dg/ext/dllimport2.C: New file. * testsuite/g++.dg/ext/dllimport3.C: New file. From-SVN: r67049
This commit is contained in:
parent
36f72608a3
commit
16e3196411
7 changed files with 70 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
PR c++/9738
|
||||
* config/i386/winnt.c (i386_pe_encode_section_info): Enable
|
||||
even if not first.
|
||||
|
||||
2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* genautomata.c (output_description, output_automaton_units,
|
||||
|
|
|
@ -427,9 +427,6 @@ i386_pe_encode_section_info (decl, rtl, first)
|
|||
rtx rtl;
|
||||
int first;
|
||||
{
|
||||
if (!first)
|
||||
return;
|
||||
|
||||
default_encode_section_info (decl, rtl, first);
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
|
@ -445,7 +442,8 @@ i386_pe_encode_section_info (decl, rtl, first)
|
|||
}
|
||||
|
||||
/* Mark the decl so we can tell from the rtl whether the object is
|
||||
dllexport'd or dllimport'd. */
|
||||
dllexport'd or dllimport'd. This also handles dllexport/dllimport
|
||||
override semantics. */
|
||||
|
||||
if (i386_pe_dllexport_p (decl))
|
||||
i386_pe_mark_dllexport (decl);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
PR c++/9738
|
||||
* decl.c (duplicate_decls): Re-invoke make_decl_rtl
|
||||
if the old decl had instantiated DECL_RTL.
|
||||
(Base on Richard Henderson 2003-05-13 patch to c-decl.c).
|
||||
|
||||
2003-05-19 Matt Austern <austern@apple.com>
|
||||
|
||||
* lang-options.h: Document -Wno-invalid-offsetof
|
||||
|
|
|
@ -3593,6 +3593,15 @@ duplicate_decls (tree newdecl, tree olddecl)
|
|||
Update OLDDECL to be the same. */
|
||||
DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
|
||||
|
||||
/* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
|
||||
so that encode_section_info has a chance to look at the new decl
|
||||
flags and attributes. */
|
||||
if (DECL_RTL_SET_P (olddecl)
|
||||
&& (TREE_CODE (olddecl) == FUNCTION_DECL
|
||||
|| (TREE_CODE (olddecl) == VAR_DECL
|
||||
&& TREE_STATIC (olddecl))))
|
||||
make_decl_rtl (olddecl, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
PR c++/9738
|
||||
* g++.dg/ext/dllimport2.C: New file.
|
||||
* g++.dg/ext/dllimport3.C: New file.
|
||||
|
||||
2003-05-20 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/compat/struct-by-value-3_x.c: Move common pieces to headers.
|
||||
|
|
15
gcc/testsuite/g++.dg/ext/dllimport2.C
Normal file
15
gcc/testsuite/g++.dg/ext/dllimport2.C
Normal file
|
@ -0,0 +1,15 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
// PR 9738 Dllimport attribute is overriden by later definition
|
||||
|
||||
void __attribute__((dllimport)) Bar(void);
|
||||
|
||||
void Foo(void)
|
||||
{
|
||||
Bar();
|
||||
}
|
||||
|
||||
void Bar(void)
|
||||
{
|
||||
}
|
||||
|
25
gcc/testsuite/g++.dg/ext/dllimport3.C
Normal file
25
gcc/testsuite/g++.dg/ext/dllimport3.C
Normal file
|
@ -0,0 +1,25 @@
|
|||
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
|
||||
|
||||
// PR 10148 Dllimport attribute of object is overriden by later
|
||||
// redefinition without attribute.
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
};
|
||||
|
||||
__attribute__((dllimport)) struct Foo f;
|
||||
|
||||
void Bar(void)
|
||||
{
|
||||
void* dummy = &f;
|
||||
}
|
||||
|
||||
struct Foo f;
|
||||
|
||||
// Dllimport sets DECL_NON_ADDR_CONST_P to 1, so following
|
||||
// assignment would require static_initialization_and_destruction
|
||||
// if attribute is retained.
|
||||
|
||||
void* dummy = &f;
|
||||
|
Loading…
Add table
Reference in a new issue