Commit 400fbc08 by Mark Mitchell Committed by Mark Mitchell

decl2.c (generate_ctor_or_dtor_function): Tolerate a non-existant ssdf_decls array.

	* decl2.c (generate_ctor_or_dtor_function): Tolerate a
	non-existant ssdf_decls array.
	(finish_file): Call generator_ctor_or_dtor_function when there are
	static constructors or destructors and no other static
	initializations.

	* g++.dg/init/attrib1.C: New test.

From-SVN: r64979
parent bbacb998
2003-03-28 Mark Mitchell <mark@codesourcery.com>
* decl2.c (generate_ctor_or_dtor_function): Tolerate a
non-existant ssdf_decls array.
(finish_file): Call generator_ctor_or_dtor_function when there are
static constructors or destructors and no other static
initializations.
2003-03-28 Nathan Sidwell <nathan@codesourcery.com>
PR c++/10047
......
......@@ -2494,6 +2494,7 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority)
/* Call the static storage duration function with appropriate
arguments. */
if (ssdf_decls)
for (i = 0; i < ssdf_decls->elements_used; ++i)
{
arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0),
......@@ -2838,6 +2839,15 @@ finish_file ()
splay_tree_foreach (priority_info_map,
generate_ctor_and_dtor_functions_for_priority,
/*data=*/0);
else
{
if (static_ctors)
generate_ctor_or_dtor_function (/*constructor_p=*/true,
DEFAULT_INIT_PRIORITY);
if (static_dtors)
generate_ctor_or_dtor_function (/*constructor_p=*/false,
DEFAULT_INIT_PRIORITY);
}
/* We're done with the splay-tree now. */
if (priority_info_map)
......
2003-03-28 Mark Mitchell <mark@codesourcery.com>
* g++.dg/init/attrib1.C: New test.
2003-03-28 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/ultrasp8.c: New test.
......
// { dg-do run }
void f() __attribute((__constructor__));
int i;
void f() { i = 1; }
int main(int, char **)
{
return 1-i;
}
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