aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-08-11 09:21:37 +0000
committerRichard Stallman <rms@gnu.org>1992-08-11 09:21:37 +0000
commit001af587150d86c4548f998fba9ff3f6ad96781b (patch)
tree23065eb38c983d654e80f98b74283a3278bf770d /gcc
parentb5c525860dc6e776b1ae2593bb9ed1a1b4fd42d8 (diff)
downloadgcc-001af587150d86c4548f998fba9ff3f6ad96781b.zip
gcc-001af587150d86c4548f998fba9ff3f6ad96781b.tar.gz
gcc-001af587150d86c4548f998fba9ff3f6ad96781b.tar.bz2
(parser_build_binary_op): Warn about expressions like `1<=i<=N'.
From-SVN: r1794
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 0cd4bff..9297d48 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'