http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47980
--- Comment #2 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> 2011-03-03 21:50:07 UTC --- I agree that the code is correct. The bug is because of a missing optimization, not about wrong behavior. The only use of foo is passing it function expecting a const pointer. Gcc could remove the copy and just pass a pointer to the global it created to hold the string. p.s.: how do I reopen the bug?