OSDN Git Service

2012-05-10 Tristan Gingold <gingold@adacore.com>
authorgingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 08:04:18 +0000 (08:04 +0000)
committergingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 08:04:18 +0000 (08:04 +0000)
* 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

libcpp/ChangeLog
libcpp/expr.c

index 7365c4e..07ef243 100644 (file)
@@ -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
index d56e56a..ca1c3d1 100644 (file)
@@ -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.  */