[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#158704: gcc: gcc compiles incorrect loop



Carlos O'Donell wrote:
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?

Not an error because the code is in fact correct, but a warning about unreachable code would be nice.


Regards,
Bart

--

Leiden Institute of Advanced Computer Science (LIACS)
E-mail: bsamwel@liacs.nl    Telephone: +31-71-5277037
Opinions stated in this e-mail are mine and not necessarily my employer's.





Reply to: