re PR lto/46083 (gcc.dg/initpri1.c FAILs with -flto/-fwhopr (attribute constructor/destructor doesn't work))
PR lto/46083 * lto-streamer-out.c (pack_ts_function_decl_value_fields): Store DECL_FINI_PRIORITY. * lto-streamer-in.c (unpack_ts_function_decl_value_fields): Restore DECL_FINI_PRIORITY. * gcc.dg/initpri3.c: New testcase. From-SVN: r168642
This commit is contained in:
parent
b88e4ef16c
commit
06c9eb5136
@ -1,3 +1,11 @@
|
||||
2011-01-10 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR lto/46083
|
||||
* lto-streamer-out.c (pack_ts_function_decl_value_fields): Store
|
||||
DECL_FINI_PRIORITY.
|
||||
* lto-streamer-in.c (unpack_ts_function_decl_value_fields):
|
||||
Restore DECL_FINI_PRIORITY.
|
||||
|
||||
2011-01-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
* doc/gimple.texi: Fix quoting of multi-word return values in
|
||||
|
@ -1683,6 +1683,11 @@ unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
|
||||
DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1);
|
||||
DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
|
||||
DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
|
||||
if (DECL_STATIC_DESTRUCTOR (expr))
|
||||
{
|
||||
priority_type p = (priority_type) bp_unpack_value (bp, HOST_BITS_PER_SHORT);
|
||||
SET_DECL_FINI_PRIORITY (expr, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,6 +496,8 @@ pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
|
||||
bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1);
|
||||
bp_pack_value (bp, DECL_PURE_P (expr), 1);
|
||||
bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1);
|
||||
if (DECL_STATIC_DESTRUCTOR (expr))
|
||||
bp_pack_value (bp, DECL_FINI_PRIORITY (expr), HOST_BITS_PER_SHORT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2011-01-10 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR lto/46083
|
||||
* gcc.dg/initpri3.c: New testcase.
|
||||
|
||||
2011-01-10 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR lto/47222
|
||||
|
64
gcc/testsuite/gcc.dg/initpri3.c
Normal file
64
gcc/testsuite/gcc.dg/initpri3.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* { dg-do run { target init_priority } } */
|
||||
/* { dg-require-effective-target lto } */
|
||||
/* { dg-options "-flto -O3" } */
|
||||
|
||||
extern void abort ();
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
void c1() __attribute__((constructor (500)));
|
||||
void c2() __attribute__((constructor (700)));
|
||||
void c3() __attribute__((constructor (600)));
|
||||
|
||||
void c1() {
|
||||
if (i++ != 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void c2() {
|
||||
if (i++ != 2)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void c3() {
|
||||
if (i++ != 1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void d1() __attribute__((destructor (500)));
|
||||
void d2() __attribute__((destructor (700)));
|
||||
void d3() __attribute__((destructor (600)));
|
||||
|
||||
void d1() {
|
||||
if (--i != 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void d2() {
|
||||
if (--i != 2)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void d3() {
|
||||
if (j != 2)
|
||||
abort ();
|
||||
if (--i != 1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
void cd4() __attribute__((constructor (800), destructor (800)));
|
||||
|
||||
void cd4() {
|
||||
if (i != 3)
|
||||
abort ();
|
||||
++j;
|
||||
}
|
||||
|
||||
int main () {
|
||||
if (i != 3)
|
||||
return 1;
|
||||
if (j != 1)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user