From 001af587150d86c4548f998fba9ff3f6ad96781b Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Tue, 11 Aug 1992 09:21:37 +0000 Subject: [PATCH] (parser_build_binary_op): Warn about expressions like `1<=i<=N'. From-SVN: r1794 --- gcc/c-typeck.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 0cd4bff7e01..9297d488a52 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2136,6 +2136,11 @@ parser_build_binary_op (code, arg1, arg2) class = TREE_CODE_CLASS (TREE_CODE (result)); + /* Similarly, check for cases like 1<=i<=10 that are probably errors. */ + if (class == '<' && extra_warnings + && (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')) + warning ("comparisons like X<=Y<=Z do not have their mathematical meaning"); + /* Record the code that was specified in the source, for the sake of warnings about confusing nesting. */ if (class == 'e' || class == '1' -- 2.30.2