This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/71926] New: wrong -Wparentheses warning


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71926

            Bug ID: 71926
           Summary: wrong -Wparentheses warning
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: izaberina at gmail dot com
  Target Milestone: ---

int main() {
  int a = 1, b = 2, c = 3, d = 4;
  if (a = 2 || (b != 3 &&
                      c != 4 && d != 5)) return 1;
  return 0;
}


-Wparentheses produces the following warning:

gccfail.c:4:23: warning: suggest parentheses around assignment used as truth
value [-Wparentheses]
                       c != 4 && d != 5)) return 1;
                       ^



gcc found the problem, but the warning is pretty misleading: i was about to
ignore it because it looked like a bogus warning

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]