http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50199

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-27 
10:12:59 UTC ---
So it means that for constants we cannot really propagate address-taken
string-csts (or any other csts) but we have to use CONST_DECLs, give them
global scope and eventually register them with the varpool.  Even without
LTO and for

const char *return_foo (void) { return "foo"; }

int main()
{
  if (return_foo () != return_foo ())
    abort ();
}

if we inline return_foo into main twice and fail to constant-propagate
and thus fold the equality on the tree level (we can do that, C does
say whether "foo" != "foo" should be true or false), with -fno-merge-constants
we would fail the testcase if we did not (by luck, I guess) share
the STRING_CST.

For LTO we cannot rely on that "luck".

Honza, do we register CONST_DECLs with the varpool at all?  Or how would
we be able to guarantee that we emit them only once?

Probably not really P1, as a non-stage1 fix is likely a bit invasive
(not sure if surgery at lto streaming time is possible).

Reply via email to