public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/89126] missing -Wtype-limits for int variables
[not found] <bug-89126-4@http.gcc.gnu.org/bugzilla/>
@ 2021-01-05 3:49 ` linkw at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: linkw at gcc dot gnu.org @ 2021-01-05 3:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89126
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |linkw at gcc dot gnu.org
--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #3)
> Eventually, after the function returns the inequality expression without a
> warning, c_parser_condition() calls c_fully_fold() on it which folds it into
> a constant, without a warning.
Happened to notice this PR when trying to answer the question [1]. The part
doing the folding is from match.pd.
/* Non-equality compare simplifications from fold_binary */
(for cmp (lt gt le ge)
/* Comparisons with the highest or lowest possible integer of
the specified precision will have known values. */
(simplify
(cmp (convert?@2 @0) uniform_integer_cst_p@1)
...
(if (wi::to_wide (cst) == max)
(switch
(if (cmp == GT_EXPR)
{ constant_boolean_node (false, type); })
(if (cmp == GE_EXPR)
(eq @2 @1))
(if (cmp == LE_EXPR)
{ constant_boolean_node (true, type); })
I noticed there are some warning support in match.pd like
fold_overflow_warning. Not sure whether we can add the similar supports there.
Probably hard to get LOC?
[1] https://gcc.gnu.org/pipermail/gcc-help/2021-January/139755.html
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-05 3:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-89126-4@http.gcc.gnu.org/bugzilla/>
2021-01-05 3:49 ` [Bug c/89126] missing -Wtype-limits for int variables linkw at gcc dot gnu.org
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).