GCC and out-of-range constant array indexes?

Manuel López-Ibáñez lopezibanez@gmail.com
Sat Oct 9 20:10:00 GMT 2010


On 9 October 2010 21:34, Jakub Jelinek <jakub@redhat.com> wrote:
> On Sat, Oct 09, 2010 at 09:22:42PM +0200, Manuel L?pez-Ib??ez wrote:
>> My intention by answering Gary is to point out that if he is thinking
>> about working on this problem, he should consider building a cheap
>> FE-specific CFG, rather than try to share the current infrastructure
>> between FE and middle-end. I would like to see this implemented, so
>
> I don't think that's a good idea.  Much better would be just to
> not emit diagnostics, which shouldn't be emitted for dead code, right away,
> but instead of that queue it into the IL (in a form of something
> like __builtin_diagnostics, or something similar).  Then after cfg cleanup + DCE
> has been run (or at expansion time?) we could issue diagnostics for the
> __builtin_diagnostics left in the IL afterwards.  For -O0 if no DCE happens
> at all we could have some cheap pass that would just nuke obviously unreachable
> __builtin_diagnostics and don't modify the IL otherwise (of course gated on
> whether there are any in the IL).

That doesn't solve the problem of diagnostics changing at different
optimization levels. But I don't care much about that, so I wouldn't
complain if anyone implemented either option.

Cheers,

Manuel.



More information about the Gcc mailing list