reassign 158704 gcc-2.95
retitle 158704 [fix in 3.2] gcc doesn't warn about unreachable code
tags 158704 + fixed
thanks
$ gcc-3.2 -Wall -W -Wunreachable-code bug-158704.c
bug-158704.c: In function `main':
bug-158704.c:12: warning: will never be executed
Carlos O'Donell writes:
> > >The issue is a
Processing commands for [EMAIL PROTECTED]:
> reassign 158704 gcc-2.95
Bug#158704: gcc: gcc compiles incorrect loop
Bug reassigned from package `gcc' to `gcc-2.95'.
> retitle 158704 [fix in 3.2] gcc doesn't warn about unreachable code
Bug#158704: gcc: gcc compiles incorrect l
> >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
>
Originally this had appeared
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 c
> 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 =
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)
/*
Package: gcc
Version: 2:2.95.4-16
Severity: normal
gcc compiles following program without emitting warning even with
-Wall -ansi -pedantic. gcc-3.2 also compiles this program.
int main()
{
int a = 0;
while (a == 0) {
a = 1;
} while (1);
return 0;
}
-- System Information
Debian
7 matches
Mail list logo