diff options
author | Tristan Gingold <gingold@adacore.com> | 2012-05-10 08:04:18 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@gcc.gnu.org> | 2012-05-10 08:04:18 +0000 |
commit | 638d20652bd82d36495fc024a5a618dfd349969e (patch) | |
tree | 4e88d90ae37850a0a770a03a9848b6995b1e5935 /libcpp/expr.c | |
parent | 3ac8781c36d6f1ce612e5233dc9254d2d8cee5ca (diff) | |
download | gcc-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.c | 13 |
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. */ |