Andrew Pinski writes:
> On Tue, Sep 14, 2010 at 11:47 AM, Uday P. Khedker wrote:
>> Attached please find two dumps t.c.032t.mergephi1 and t.c.033t.cddce1.
>> The assignment is present in the former while it disappears in the
>> latter. The latter dump is the output of the dead code elimination
>
On 14/09/2010 19:47, Uday P. Khedker wrote:
> But may be you are right, what facilitate dead code elimination
> be based on modification of read-only data. However, if that is
> the case, I wonder what is the reason why change happens when s is
> an array...
Because the array, unlike the string
On Tue, Sep 14, 2010 at 2:35 PM, Ian Lance Taylor wrote:
>
> I think this is simply a bug. It doesn't happen with current gcc. With
> gcc 4.4.3 the assignment is being eliminated because it is considered to
> be dead code.
>
> I agree that it is an error for gcc to simply eliminate this assignme
You got me there :-)
Yes you are right. The reason I gave for dead code elimination is not
sound! Should have thought a bit before writing :-(
Uday.
Axel Freyn wrote, On Wednesday 15 September 2010 12:05 AM:
Hello Uday,
On Tue, Sep 14, 2010 at 11:50:11PM +0530, Uday P. Khedker wrote:
[..]
The
On Tue, Sep 14, 2010 at 11:47 AM, Uday P. Khedker wrote:
> Attached please find two dumps t.c.032t.mergephi1 and t.c.033t.cddce1.
> The assignment is present in the former while it disappears in the
> latter. The latter dump is the output of the dead code elimination
> pass pass_cd_dce. So this is
Attached please find two dumps t.c.032t.mergephi1 and t.c.033t.cddce1.
The assignment is present in the former while it disappears in the
latter. The latter dump is the output of the dead code elimination
pass pass_cd_dce. So this is indeed an instance of dead code elimination.
But may be you are
Hello Uday,
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
Godmar Back writes:
> this may be a FAQ - in my class today when discussing how gcc
> generates code for x86, I was stumped when I showed an example of how
> gcc handles attempts to modify (read-only) string literals/constants.
> (I'm sending this to gcc rather than gcc-help because I'm asking fo
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 optimi
Interesting example indeed!
Replace the declaration of s to
char s[] = "hello";
and see "Hello" being printed :-)
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
Hi,
this may be a FAQ - in my class today when discussing how gcc
generates code for x86, I was stumped when I showed an example of how
gcc handles attempts to modify (read-only) string literals/constants.
(I'm sending this to gcc rather than gcc-help because I'm asking for a
design rationale - I
11 matches
Mail list logo