[PATCH] Stack corruption in naked functions.

Richard Guenther richard.guenther@gmail.com
Fri May 23 19:55:00 GMT 2008


On Fri, May 23, 2008 at 8:37 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> Paul Brook wrote:
>
>> If the stack slots result from code not permitted by the documentation
>> then this is user error.  Some not-permitted code may happen to "work" at
>> some optimisation levels with some compilers. However when this stops
>> working (e.g. at -O0) it is IMHO not defect in the compiler, it is user
>> error.  If anything the bug is that we allowed the code in the first place.
>
> I agree.
>
> As I see it, Carlos' patch makes things monotonically better.  It makes a
> valid test case work, and it causes no new failures.  Richard's comment is
> about what might happen with invalid code, but Carlos' patch is about valid
> code.  We could perhaps do better to catch more errors in the front ends,
> but that's an orthogonal issue.
>
> Richard, are you objecting to the patch?

I merely wanted to raise the concern that user errors will be noticed as ICEs
and not errors, which will lead to false bug-reports.  It would be nice if we
can emit an error, even if we cannot make sure to not ICE afterwards - that
will be a confused after errors, which is way better than an ICE with an
instruction to report a bug.

It's not clear to me if going this route has been evaluated?  IMHO we
don't need to rush in this change at this point before this was done.
The change itself looks to be papering over the problem - Carlos, can
you try Honzas patch for going into SSA at -O0 and look at what optimizations
you would need to make the valid testcases also work with -O0?

Thanks,
Richard.



More information about the Gcc-patches mailing list