[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 Stephan Bergmann changed: What|Removed |Added CC||sbergman at redhat dot com --- Comment #10 from Stephan Bergmann --- (In reply to Jason Merrill from comment #8) > Author: jason > Date: Wed Apr 3 20:12:00 2019 > New Revision: 270136 > > URL: https://gcc.gnu.org/viewcvs?rev=270136=gcc=rev > Log: > PR c++/86586 - -fcompare-debug=-Wsign-compare. > > This patch limits constexpr folding for -Wsign-compare to only cases that we > would warn for without considering constant values, avoiding the folding in > the testcase in question. Starting with that commit, constexpr int f() { return 0; } bool b = f() != 0xU; now emits a -Wsign-compare, while the similar constexpr int f() { return 0; } constexpr int n = f(); bool b = n != 0xU; still does not. I assume that is an unintended regression?
[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 Jason Merrill changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC||jason at gcc dot gnu.org Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org Target Milestone|7.5 |9.0 --- Comment #9 from Jason Merrill --- Fixed for GCC 9 by not folding on this testcase. This doesn't address the general issue, but reduces its scope. Not worth backporting.
[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 --- Comment #8 from Jason Merrill --- Author: jason Date: Wed Apr 3 20:12:00 2019 New Revision: 270136 URL: https://gcc.gnu.org/viewcvs?rev=270136=gcc=rev Log: PR c++/86586 - -fcompare-debug=-Wsign-compare. This patch limits constexpr folding for -Wsign-compare to only cases that we would warn for without considering constant values, avoiding the folding in the testcase in question. gcc/c-family/ * c-warn.c (warn_for_sign_compare): Call fold_for_warn. gcc/cp/ * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare. Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-warn.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c trunk/gcc/testsuite/g++.target/i386/mv1.C
[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 Richard Biener changed: What|Removed |Added Target Milestone|7.4 |7.5
[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 Richard Biener changed: What|Removed |Added Priority|P3 |P2
[Bug c++/86586] [7/8/9 Regression] -Wsign-compare affects code generation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86586 Richard Biener changed: What|Removed |Added Target Milestone|--- |7.4