aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2007-05-14 23:43:07 +0000
committerJanis Johnson <janis@gcc.gnu.org>2007-05-14 23:43:07 +0000
commit30e04921873057fd9c85458127e51862d0cf2304 (patch)
treeb853079a0b6c6486743cd6cf3116784b5035dce2 /libcpp
parentd077694a0f9e7fdb7fb663e66f2200e33b7230ad (diff)
downloadgcc-30e04921873057fd9c85458127e51862d0cf2304.zip
gcc-30e04921873057fd9c85458127e51862d0cf2304.tar.gz
gcc-30e04921873057fd9c85458127e51862d0cf2304.tar.bz2
re PR c/31924 (gcc accepts invalid suffixes for decimal float constants)
libcpp/ PR c/31924 * expr.c (interpret_float_suffix): Check for invalid suffix. gcc/testsuite/ PR c/31924 * gcc.dg/fltconst-1.c: New test. From-SVN: r124730
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/expr.c19
2 files changed, 16 insertions, 8 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index cc5a716..5b941ff 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-14 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/31924
+ * expr.c (interpret_float_suffix): Check for invalid suffix.
+
2007-05-02 Eric Christopher <echristo@apple.com>
* expr.c (num_div_op): Don't overflow if the result is
diff --git a/libcpp/expr.c b/libcpp/expr.c
index a006140..8401dae 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -87,16 +87,19 @@ interpret_float_suffix (const uchar *s, size_t len)
while (len--)
switch (s[len])
{
- case 'f': case 'F': f++; break;
- case 'l': case 'L': l++; break;
- case 'i': case 'I':
- case 'j': case 'J': i++; break;
- case 'd': case 'D':
- /* Disallow fd, ld suffixes. */
- if (d && (f || l))
+ case 'f': case 'F':
+ if (d > 0)
+ return 0;
+ f++;
+ break;
+ case 'l': case 'L':
+ if (d > 0)
return 0;
- d++;
+ l++;
break;
+ case 'i': case 'I':
+ case 'j': case 'J': i++; break;
+ case 'd': case 'D': d++; break;
default:
return 0;
}