[Bug c++/64524] New: gcc can't detect same expression in both parts of ternary operator
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 7 16:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64524
Bug ID: 64524
Summary: gcc can't detect same expression in both parts of
ternary operator
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Given this source code
extern void g(int);
void
f( int n)
{
int i = (n >= 10) ? 1 : 1;
g( i - 1);
}
then trunk gcc says nothing:
$ ~/gcc/results/bin/gcc -c -O2 -Wall -Wextra jan6c.cc
$
Here is cppcheck detecting the problem:
$ ~/cppcheck/trunk/cppcheck --enable=all jan6c.cc
Checking jan6c.cc...
[jan6c.cc:9]: (style) Same expression in both branches of ternary operator.
$
Fixing this bug would find about a dozen bugs in Linux kernel
and about 100 bugs in Fedora Linux.
More information about the Gcc-bugs
mailing list