* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168642
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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);
+ }
}
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);
}
+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
--- /dev/null
+/* { 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;
+}