This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615
On Wed, Jan 21, 2009 at 12:45 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Wed, 21 Jan 2009, Richard Guenther wrote:
>
>> This variant is ok if you add a comment before the !TREE_ADDRESSABLE
>> check. As Paolo notes it may be useful to preserve this optimization,
>> so please file an enhacement PR with his testcase (I would say we
>> could simply introduce an optimization option that disregards the
>> TREE_ADDRESSABLE check).
>
> You could add that to the semantics of -fmerge-all-constants (with a
> slight adjustment to its documentation) rather than needing a new option.
Ah, indeed. It seems to cover this case already. Quoting:
"This option implies @option{-fmerge-constants}. In addition to
@option{-fmerge-constants} this considers e.g.@: even constant initialized
arrays or initialized constant variables with integral or floating point
types. Languages like C or C++ require each non-automatic variable to
have distinct location, so using this option will result in non-conforming
behavior."
In the testcase the array is non-automatic (as you have its address
taken).
Richard.
- References:
- [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615
- Re: [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615
- Re: [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615
- Re: [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615
- Re: [patch, wrong-code, 4.2/4.3/4.4 regression] Patch for PR38615