Commit 2062f77b by Paul Brook Committed by Paul Brook

cgraphunit.c: Don't mark clones as static constructors.

2011-10-31  Paul Brook  <paul@codesourcery.com>

	gcc/
	* cgraphunit.c: Don't mark clones as static constructors.

	gcc/testsuite/
	* gcc.dg/constructor-1.c: New test.

From-SVN: r180700
parent 41bd49ea
2011-10-31 Paul Brook <paul@codesourcery.com>
* cgraphunit.c: Don't mark clones as static constructors.
2011-10-31 David Edelsohn <dje.gcc@gmail.com>
* gcc-ar: Do not include stdio.h.
......@@ -2366,6 +2366,10 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
SET_DECL_RTL (new_decl, NULL);
/* When the old decl was a con-/destructor make sure the clone isn't. */
DECL_STATIC_CONSTRUCTOR(new_decl) = 0;
DECL_STATIC_DESTRUCTOR(new_decl) = 0;
/* Create the new version's call-graph node.
and update the edges of the new node. */
new_version_node =
......
2011-10-31 Paul Brook <paul@codesourcery.com>
* gcc.dg/constructor-1.c: New test.
2011-10-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/50753
......
/* { dg-do run } */
/* { dg-options "-O2" } */
/* The ipa-split pass pulls the body of the if(!x) block
into a separate function to make foo a better inlining
candidate. Make sure this new function isn't also run
as a static constructor. */
#include <stdlib.h>
int x, y;
void __attribute__((noinline))
bar(void)
{
y++;
}
void __attribute__((constructor))
foo(void)
{
if (!x)
{
bar();
y++;
}
}
int main()
{
x = 1;
foo();
foo();
if (y != 2)
abort();
exit(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment