Commit a7935284 by Bingfeng Mei Committed by Bingfeng Mei

re PR lto/61868 (-frandom-seed always results in random_seed of 0)

2014-07-31  Bingfeng Mei <bmei@broadcom.com>

	PR lto/61868
	* toplev.c (init_random_seed): Move piece of code never called to
	set_random_seed.
	(set_random_seed): see above.
	
	* gcc.dg/pr61868.c: New test.

From-SVN: r213321
parent 3e455386
2014-07-31 Bingfeng Mei <bmei@broadcom.com>
PR lto/61868
* toplev.c (init_random_seed): Move piece of code never called to
set_random_seed.
(set_random_seed): see above.
2014-07-31 Tom de Vries <tom@codesourcery.com>
* tree-ssa-loop.c (pass_tree_loop_init::execute): Remove dead code.
......
2014-07-31 Bingfeng Mei <bmei@broadcom.com>
PR lto/61868
* gcc.dg/pr61868.c: New test.
2014-07-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57397
......
/* { 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" } } */
......@@ -282,16 +282,7 @@ init_local_tick (void)
static void
init_random_seed (void)
{
if (flag_random_seed)
{
char *endp;
/* When the driver passed in a hex number don't crc it again */
random_seed = strtoul (flag_random_seed, &endp, 0);
if (!(endp > flag_random_seed && *endp == 0))
random_seed = crc32_string (0, flag_random_seed);
}
else if (!random_seed)
if (!random_seed)
random_seed = local_tick ^ getpid (); /* Old racey fallback method */
}
......@@ -314,6 +305,15 @@ set_random_seed (const char *val)
{
const char *old = flag_random_seed;
flag_random_seed = val;
if (flag_random_seed)
{
char *endp;
/* When the driver passed in a hex number don't crc it again */
random_seed = strtoul (flag_random_seed, &endp, 0);
if (!(endp > flag_random_seed && *endp == 0))
random_seed = crc32_string (0, flag_random_seed);
}
return old;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment