This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: RFA: fix assertion in c-cppbuiltin.c

Cedric Berger pointed out that an assertion in my java class file
versioning patch looked somewhat off.  I had copied this assertion
from c-cppbuiltin.c.  It in turn was changed from an abort(), the
original hunk in question:

    -  if (*v != '.' || !ISDIGIT (v[1]))
    -    abort ();
    +  gcc_assert (*v == '.' || ISDIGIT (v[1]));

As Cedric pointed out, this patch didn't properly invert the
condition.  As a result, in theory, we could read past the end of the
version string in the test.

This patch fixes the condition to its original meaning.  Ok?


Index: ChangeLog
from  Tom Tromey  <>

	* c-cppbuiltin.c (define__GNUC__): Correct assertion.

Index: c-cppbuiltin.c
RCS file: /cvs/gcc/gcc/gcc/c-cppbuiltin.c,v
retrieving revision 1.28
diff -u -r1.28 c-cppbuiltin.c
--- c-cppbuiltin.c 18 Jan 2005 11:35:59 -0000 1.28
+++ c-cppbuiltin.c 20 Jan 2005 23:44:40 -0000
@@ -275,7 +275,7 @@
   if (c_dialect_cxx ())
     builtin_define_with_value_n ("__GNUG__", q, v - q);
-  gcc_assert (*v == '.' || ISDIGIT (v[1]));
+  gcc_assert (*v == '.' && ISDIGIT (v[1]));
   q = ++v;
   while (ISDIGIT (*v))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]