aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-02-16 16:17:17 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2019-02-16 16:17:17 +0000
commit3fe53000bbaa5024af7ceecb950e0a7fd6b189e3 (patch)
treed4ce7caa5c4014625f6fccf5e7a10714d8b7e302 /gcc/fortran/simplify.c
parent9dbdefbb201dd67cd1ce795e969c3ae1a850c31d (diff)
downloadgcc-3fe53000bbaa5024af7ceecb950e0a7fd6b189e3.zip
gcc-3fe53000bbaa5024af7ceecb950e0a7fd6b189e3.tar.gz
gcc-3fe53000bbaa5024af7ceecb950e0a7fd6b189e3.tar.bz2
Fix excess warnings from -Wtype-limits with location wrappers (PR c++/88680)
PR c++/88680 reports excess warnings from -Wtype-limits after the C++ FE's use of location wrappers was extended in r267272 for cases such as: const unsigned n = 8; static_assert (n >= 0 && n % 2 == 0, ""); t.C:3:18: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 3 | static_assert (n >= 0 && n % 2 == 0, ""); | ~~^~~~ The root cause is that the location wrapper around "n" breaks the suppression of the warning for the "if OP0 is a constant that is >= 0" case. This patch fixes it by calling fold_for_warn on OP0, extracting the constant. gcc/c-family/ChangeLog: PR c++/88680 * c-common.c (shorten_compare): Call fold_for_warn on op0 when implementing -Wtype-limits. gcc/testsuite/ChangeLog: PR c++/88680 * g++.dg/wrappers/pr88680.C: New test. From-SVN: r268961
Diffstat (limited to 'gcc/fortran/simplify.c')
0 files changed, 0 insertions, 0 deletions