summaryrefslogtreecommitdiff
path: root/libcpp/expr.c
diff options
context:
space:
mode:
authorgingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-10 08:04:18 +0000
committergingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-10 08:04:18 +0000
commit3069d7f8d2840d34d159b2f5b9078b80a867503a (patch)
tree4e88d90ae37850a0a770a03a9848b6995b1e5935 /libcpp/expr.c
parent5a1fe2db4de27e5d885582b199332d5672e2da16 (diff)
downloadgcc-3069d7f8d2840d34d159b2f5b9078b80a867503a.tar.gz
2012-05-10 Tristan Gingold <gingold@adacore.com>
* expr.c (interpret_float_suffix): Add a guard. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187364 138bc75d-0d04-0410-961f-82ee72b054a4
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 d56e56a6311..ca1c3d1928a 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. */