rationale for eliding modifications to string constants
Daniel Jacobowitz
dan@codesourcery.com
Tue Sep 14 19:17:00 GMT 2010
On Tue, Sep 14, 2010 at 11:50:11PM +0530, Uday P. Khedker wrote:
> The point is: in your program is is only a pointer. When you pass s
> as a parameter to printf, the compiler assumes that only s is being
> used so the (effective) assignment
>
> *s = 'H'
>
> is deleted as dead code when optimization is enabled.
No, this is incorrect. The issue must be specific to modification of
read-only data.
--
Daniel Jacobowitz
CodeSourcery
More information about the Gcc
mailing list