[PATCH] Fix middle-end/38661, ICE in tree-switch-conversion with INT_MAX as the case statement

Richard Guenther richard.guenther@gmail.com
Tue Dec 30 14:40:00 GMT 2008


On Tue, Dec 30, 2008 at 1:47 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>  The problem here is that if we have INT_MAX as a case statement, pos
> in build_constructors would wrap around which will cause an infinite
> loop.
> The fix is to change the loop into a do/while loop and look for the
> wrapping case.
>
> OK? Bootstrapped and tested on i386-darwin8.11 with no regressions.

Ok.

Thanks,
Richard.

> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * tree-switch-conversion.c (build_constructors): Test for wrapping of pos case.
>
>
> * gcc.c-torture/compile/pr38661.c: New testcase.
> * gcc.c-torture/compile/pr38661-1.c: New testcase.
>



More information about the Gcc-patches mailing list