Hi,
this is final version I comitted.  20110201-1_0.c actually tests that we
optimize cabs on function copmiled with -O0 that is no longer supposed to
happen.

Honza

        PR lto/64043
        * gcc.dg/lto/20110201-1_0.c: New testcase.

        * tree-streamer.c (preload_common_nodes): Skip preloading
        of main_identifier_node, pid_type and optimization/option nodes.
Index: testsuite/gcc.dg/lto/20110201-1_0.c
===================================================================
--- testsuite/gcc.dg/lto/20110201-1_0.c (revision 218726)
+++ testsuite/gcc.dg/lto/20110201-1_0.c (working copy)
@@ -1,6 +1,5 @@
 /* { dg-lto-do run } */
 /* { dg-lto-options { { -O0 -flto } } } */
-/* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
 /* { dg-require-linker-plugin "" } */
 
 /* We require a linker plugin because otherwise we'd need to link
@@ -9,7 +8,7 @@
    which does not have folded cabs.  */
 
 double cabs(_Complex double);
-double __attribute__((used))
+double __attribute__((used)) __attribute__ ((optimize ("O2,fast-math")))
 foo (_Complex double x, int b)
 {
   if (b)
Index: tree-streamer.c
===================================================================
--- tree-streamer.c     (revision 218726)
+++ tree-streamer.c     (working copy)
@@ -324,7 +324,18 @@ preload_common_nodes (struct streamer_tr
     /* Skip boolean type and constants, they are frontend dependent.  */
     if (i != TI_BOOLEAN_TYPE
        && i != TI_BOOLEAN_FALSE
-       && i != TI_BOOLEAN_TRUE)
+       && i != TI_BOOLEAN_TRUE
+       /* MAIN_IDENTIFIER is not always initialized by Fortran FE.  */
+       && i != TI_MAIN_IDENTIFIER
+       /* PID_TYPE is initialized only by C family front-ends.  */
+       && i != TI_PID_TYPE
+       /* Skip optimization and target option nodes; they depend on flags.  */
+       && i != TI_OPTIMIZATION_DEFAULT
+       && i != TI_OPTIMIZATION_CURRENT
+       && i != TI_TARGET_OPTION_DEFAULT
+       && i != TI_TARGET_OPTION_CURRENT
+       && i != TI_CURRENT_TARGET_PRAGMA
+       && i != TI_CURRENT_OPTIMIZE_PRAGMA)
       record_common_node (cache, global_trees[i]);
 }
 

Reply via email to