public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64524] New: gcc can't detect same expression in both parts of ternary operator
@ 2015-01-07 16:54 dcb314 at hotmail dot com
  2015-01-07 17:49 ` [Bug c++/64524] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2015-01-07 16:54 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-07 20:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 16:54 [Bug c++/64524] New: gcc can't detect same expression in both parts of ternary operator dcb314 at hotmail dot com
2015-01-07 17:49 ` [Bug c++/64524] " jakub at gcc dot gnu.org
2015-01-07 18:00 ` dcb314 at hotmail dot com
2015-01-07 18:12 ` jakub at gcc dot gnu.org
2015-01-07 19:45 ` maltsevm at gmail dot com
2015-01-07 20:12 ` pinskia at gcc dot gnu.org
2015-01-07 20:38 ` dcb314 at hotmail dot com
2015-01-07 20:39 ` dcb314 at hotmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).