Bug#158704: gcc: gcc compiles incorrect loop
> Eugene,
>
> This code is completely correct as far as I can see. The second while is
> interpreted as a new while loop, and the closing; is short for {} in
> this case. I've expanded the code into a more intuitive form here:
>
> int main()
> {
> int a = 0;
>
> while (a == 0) {
> a = 1;
> }
>
> while (1)
> /* Do nothing */ ;
>
> return 0;
> }
The issue is a rather pedantic one. Should an error be generated
by the compiler indicating that 'return 0' can never be reached?
c.
Reply to: