Hi, 
Please find the patches for pr61868. The problem is that even with 
-frandom-seed gcc always uses 0 instead of specified number/string for places 
such as lto section names. init_random_seed is never called with -frandom-seed. 
Bootstrapped and tested on x86-64. OK for trunk?

Thanks,
Bingfeng Mei


===================================================================
--- ChangeLog   (revision 213152)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2014-07-29  Bingfeng Mei <b...@broadcom.com>
+
+       PR lto/61868
+       * toplev.c (init_random_seed): Generate random seed when
+       flag_random_seed is specified.
+
 2014-07-28  Jan Hubicka  <hubi...@ucw.cz>

        * cgraph.c (cgraph_node::create_indirect_edge): Copy speculative data.
Index: toplev.c
===================================================================
--- toplev.c    (revision 213152)
+++ toplev.c    (working copy)
@@ -301,7 +301,7 @@ init_random_seed (void)
 HOST_WIDE_INT
 get_random_seed (bool noinit)
 {
-  if (!flag_random_seed && !noinit)
+  if (!noinit)
     init_random_seed ();
   return random_seed;
 }
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 213152)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-07-29  Bingfeng Mei  <b...@broadcom.com>
+
+       PR lto/61868
+       * gcc.dg/pr61868.c: New test.
+
 2014-07-28  Richard Biener  <rguent...@suse.de>

        PR rtl-optimization/61801
Index: testsuite/gcc.dg/pr61868.c
===================================================================
--- testsuite/gcc.dg/pr61868.c  (revision 0)
+++ testsuite/gcc.dg/pr61868.c  (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-flto -frandom-seed=0x12345" }  */
+extern int foo (int);
+int main ()
+{
+  foo (100);
+  return 0;
+}
+/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */

Reply via email to