This is the mail archive of the
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))
- abort ();
+ gcc_assert (*v == '.' || ISDIGIT (v));
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?
from Tom Tromey <firstname.lastname@example.org>
* c-cppbuiltin.c (define__GNUC__): Correct assertion.
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));
+ gcc_assert (*v == '.' && ISDIGIT (v));
q = ++v;
while (ISDIGIT (*v))