[PATCH] PR mid-end/17657: Truncate case ranges to index's type

Steven Bosscher stevenb@suse.de
Mon Oct 11 07:05:00 GMT 2004


On Monday 11 October 2004 01:12, Roger Sayle wrote:
> I'd argue that the ability of the middle-end to eliminate the unreachable
> cases above is a valid optimization, and shouldn't result in a diagnostic.
> Not that the middle-end should ever generate warnings, but the code above
> is valid.

Yup. I moved the cases where a warning was required to the front
end.

> Steven, are you happy with this solution?  I didn't want to approve my
> own patch without checking with you that you're OK with this approach,
> especially as this PR is currently assigned to you.

I'd prefer to do this before expand to expose as much information
as possible to the tree optimizers and to clean up switch expanding.
But for the moment I don't see how because we don't see on trees
that the index expression will be cast to a smaller type (and we
not yet have any bit propagation thing to catch the other examples
you give).
So I guess for now this will have to do :-/  At least your approach
is safe.

Thanks for looking into this,

Gr.
Steven




More information about the Gcc-patches mailing list