------- Comment #5 from rguenther at suse dot de 2008-11-26 13:05 ------- Subject: Re: CCP does not propagate through constant initializers
On Wed, 26 Nov 2008, graham dot stott at btinternet dot com wrote: > > > ------- Comment #4 from graham dot stott at btinternet dot com 2008-11-26 > 13:03 ------- > Subject: Re: CCP does not propagate through constant initializers > > Hi Richard, > > Does this patch work for objects which are both const and volatile > > get_symbol_constant_value only looks at TREE_READONLY should it not > also look at TREE_VOLATILE ? > > I don't have a upto date tree to hand to try the following testcase on > > static const volatile int value = 42; > > int foo(void) > { > return value; > } > > Here it's not valid to ccp value into the return value and return 42 The patch doesn't change behavior on the (IMHO invalid or at least undefined) example above. (what do you mean by "const volatile"!?) Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38180