This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: RFA: fix assertion in c-cppbuiltin.c
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 20 Jan 2005 16:42:42 -0700
- Subject: Patch: RFA: fix assertion in c-cppbuiltin.c
- Reply-to: tromey at redhat dot com
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?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* 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))