[Bug c/31524] New: prints incorrect warning
aldot at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 10 09:27:00 GMT 2007
gcc >= 3.x emits wrong warning for assignment of bool=non-bool=value;
for bool=bool=value, no warning is emitted, which is fine.
$ for i in 2.95 3.4 4.0 4.1 4.2-HEAD 4.3-HEAD;do echo "# gcc-$i:";echo -e
"#include <stdbool.h>\nint i;bool b;int main(void){b=i=false;return b;}" |
gcc-$i -xc - -o boo -Wall;./boo ; echo ret=$?;done
# gcc-2.95:
ret=0
# gcc-3.4:
<stdin>: In function `main':
<stdin>:2: warning: suggest parentheses around assignment used as truth value
ret=0
# gcc-4.0:
<stdin>: In function 'main':
<stdin>:2: warning: suggest parentheses around assignment used as truth value
ret=0
# gcc-4.1:
<stdin>: In function 'main':
<stdin>:2: warning: suggest parentheses around assignment used as truth value
ret=0
# gcc-4.2-HEAD:
<stdin>: In function 'main':
<stdin>:2: warning: suggest parentheses around assignment used as truth value
ret=0
# gcc-4.3-HEAD:
<stdin>: In function 'main':
<stdin>:2: warning: suggest parentheses around assignment used as truth value
ret=0
--
Summary: prints incorrect warning
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aldot at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31524
More information about the Gcc-bugs
mailing list