[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-10-09 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-19 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #12 from Bernd Edlinger --- Author: edlinger Date: Mon Sep 19 22:10:11 2016 New Revision: 240251 URL: https://gcc.gnu.org/viewcvs?rev=240251=gcc=rev Log: gcc: 2016-09-19 Bernd Edlinger PR

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-03 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #11 from Bernd Edlinger --- As I said, I think "<<" on signed integers is generally bogus in a truth value context. So I tried an experiment for such a warning: Index: c-common.c

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-02 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #10 from Bernd Edlinger --- (In reply to Manuel López-Ibáñez from comment #9) > It seems to me that they are two different warnings that could be triggered > on similar code. The one warned by the patch would also warn about: > > if

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-02 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #9 from Manuel López-Ibáñez --- (In reply to Eric Gallager from comment #8) > As a user, I'd prefer warning about the missing parentheses instead of the > boolean context thing, the missing parentheses make a lot more sense to me >

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-02 Thread egall at gwmail dot gwu.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 Eric Gallager changed: What|Removed |Added CC||egall at gwmail dot gwu.edu --- Comment

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-01 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #7 from Bernd Edlinger --- (In reply to jos...@codesourcery.com from comment #6) > On Thu, 1 Sep 2016, bernd.edlinger at hotmail dot de wrote: > > > + warning_at (location, 0, > > + "?: expression using

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-01 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #6 from joseph at codesourcery dot com --- On Thu, 1 Sep 2016, bernd.edlinger at hotmail dot de wrote: > + warning_at (location, 0, > + "?: expression using integer constants in boolean > context"); This

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-01 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #5 from Bernd Edlinger --- This is an idea for a warning that does not focus on parentheses: Here we had: a ? c1 : c2; but in a context where a boolean is requested. It is always suspicious, when c1, and c2 are integer constants

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-09-01 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 Bernd Edlinger changed: What|Removed |Added CC||bernd.edlinger at hotmail dot de ---

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-08-31 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #3 from Marc Glisse --- (In reply to jos...@codesourcery.com from comment #2) > following is not suspicious and it would seem silly to warn for it: > > return (a > 0 && b <= 3 ? 1 : 2); > > (because the suggested alternative parse

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-08-31 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #2 from joseph at codesourcery dot com --- On Wed, 31 Aug 2016, joseph at codesourcery dot com wrote: > > Code such as the following are suspicious: > > > > int foo(int a, int b) > > { > > return (a > 0 && a <= (b == 1) ? 1 : 2); >

[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)

2016-08-31 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434 --- Comment #1 from joseph at codesourcery dot com --- On Wed, 31 Aug 2016, manu at gcc dot gnu.org wrote: > Code such as the following are suspicious: > > int foo(int a, int b) > { > return (a > 0 && a <= (b == 1) ? 1 : 2); Actually I don't