aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-05-10 08:04:18 +0000
committerTristan Gingold <gingold@gcc.gnu.org>2012-05-10 08:04:18 +0000
commit638d20652bd82d36495fc024a5a618dfd349969e (patch)
tree4e88d90ae37850a0a770a03a9848b6995b1e5935 /libcpp/expr.c
parent3ac8781c36d6f1ce612e5233dc9254d2d8cee5ca (diff)
downloadgcc-638d20652bd82d36495fc024a5a618dfd349969e.zip
gcc-638d20652bd82d36495fc024a5a618dfd349969e.tar.gz
gcc-638d20652bd82d36495fc024a5a618dfd349969e.tar.bz2
expr.c (interpret_float_suffix): Add a guard.
2012-05-10 Tristan Gingold <gingold@adacore.com> * expr.c (interpret_float_suffix): Add a guard. From-SVN: r187364
Diffstat (limited to 'libcpp/expr.c')
-rw-r--r--libcpp/expr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libcpp/expr.c b/libcpp/expr.c
index d56e56a..ca1c3d1 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -110,12 +110,13 @@ interpret_float_suffix (const uchar *s, size_t len)
}
/* Recognize a fixed-point suffix. */
- switch (s[len-1])
- {
- case 'k': case 'K': flags = CPP_N_ACCUM; break;
- case 'r': case 'R': flags = CPP_N_FRACT; break;
- default: break;
- }
+ if (len != 0)
+ switch (s[len-1])
+ {
+ case 'k': case 'K': flags = CPP_N_ACCUM; break;
+ case 'r': case 'R': flags = CPP_N_FRACT; break;
+ default: break;
+ }
/* Continue processing a fixed-point suffix. The suffix is case
insensitive except for ll or LL. Order is significant. */