diff options
| author | gingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-10 08:04:18 +0000 |
|---|---|---|
| committer | gingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-10 08:04:18 +0000 |
| commit | 3069d7f8d2840d34d159b2f5b9078b80a867503a (patch) | |
| tree | 4e88d90ae37850a0a770a03a9848b6995b1e5935 /libcpp | |
| parent | 5a1fe2db4de27e5d885582b199332d5672e2da16 (diff) | |
| download | ppe42-gcc-3069d7f8d2840d34d159b2f5b9078b80a867503a.tar.gz ppe42-gcc-3069d7f8d2840d34d159b2f5b9078b80a867503a.zip | |
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')
| -rw-r--r-- | libcpp/ChangeLog | 4 | ||||
| -rw-r--r-- | libcpp/expr.c | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7365c4e7beb..07ef2437834 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2012-05-10 Tristan Gingold <gingold@adacore.com> + + * expr.c (interpret_float_suffix): Add a guard. + 2012-05-02 Dodji Seketeli <dodji@redhat.com> Properly initialize cpp_context in destringize_and_run 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. */ |

