OSDN Git Service

PR 43564
authorjiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Mar 2010 13:06:50 +0000 (13:06 +0000)
committerjiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Mar 2010 13:06:50 +0000 (13:06 +0000)
* toplev.c (process_options): Set optimization_default_node
and optimization_current_node.
* opts.c (decode_options): Don't set optimization_default_node
and optimization_current_node.

testsuite/
PR 43564
* gcc.dg/pr43564.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157795 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr43564.c [new file with mode: 0644]
gcc/toplev.c

index 9d2dd62..f3b7567 100644 (file)
@@ -1,3 +1,11 @@
+2010-03-29  Jie Zhang  <jie@codesourcery.com>
+
+       PR 43564
+       * toplev.c (process_options): Set optimization_default_node
+       and optimization_current_node.
+       * opts.c (decode_options): Don't set optimization_default_node
+       and optimization_current_node.
+
 2010-03-29  Ralf Corsépius  <ralf.corsepius@rtems.org>
 
        * config/rtems.h: Abandon -qrtems_debug.
index df78027..139cd26 100644 (file)
@@ -1034,6 +1034,7 @@ decode_options (unsigned int argc, const char **argv)
        flag_pic = flag_pie;
       if (flag_pic && !flag_pie)
        flag_shlib = 1;
+      first_time_p = false;
     }
 
   if (optimize == 0)
@@ -1112,13 +1113,6 @@ decode_options (unsigned int argc, const char **argv)
       flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
     }
 
-  /* Save the current optimization options if this is the first call.  */
-  if (first_time_p)
-    {
-      optimization_default_node = build_optimization_node ();
-      optimization_current_node = optimization_default_node;
-      first_time_p = false;
-    }
   if (flag_conserve_stack)
     {
       if (!PARAM_SET_P (PARAM_LARGE_STACK_FRAME))
index b231246..e429f26 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-29  Jie Zhang  <jie@codesourcery.com>
+
+       PR 43564
+       * gcc.dg/pr43564.c: New test.
+
 2010-03-29  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/43551
diff --git a/gcc/testsuite/gcc.dg/pr43564.c b/gcc/testsuite/gcc.dg/pr43564.c
new file mode 100644 (file)
index 0000000..39e0f3a
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-options "-O0" } */
+/* { dg-do compile } */
+
+static inline __attribute__ ((__always_inline__))
+unsigned __clz (unsigned input)
+{
+  unsigned output;
+  __asm__ __volatile__ ("clz %0, %1":"=r" (output):"r" (input));
+}
+__attribute__ ((optimize ("O2")))
+void foo ()
+{
+  unsigned a;
+  unsigned b;
+  a = __clz (b);
+}
index fb3c4b2..a789383 100644 (file)
@@ -2148,6 +2148,10 @@ process_options (void)
               "for correctness");
       flag_omit_frame_pointer = 0;
     }
+
+  /* Save the current optimization options.  */
+  optimization_default_node = build_optimization_node ();
+  optimization_current_node = optimization_default_node;
 }
 
 /* This function can be called multiple times to reinitialize the compiler