Commit eeda7b98 by Ian Lance Taylor Committed by Ian Lance Taylor

cp-demangle.c (d_substitution): Correct overflow check to avoid -fstrict-overflow optimizations.

	* cp-demangle.c (d_substitution): Correct overflow check to avoid
	-fstrict-overflow optimizations.

From-SVN: r133761
parent bd60bab2
2008-03-31 Ian Lance Taylor <iant@google.com>
* cp-demangle.c (d_substitution): Correct overflow check to avoid
-fstrict-overflow optimizations.
2008-03-27 Paolo Bonzini <bonzini@gnu.org> 2008-03-27 Paolo Bonzini <bonzini@gnu.org>
* configure.ac (frags): Don't set, use frag instead. * configure.ac (frags): Don't set, use frag instead.
......
...@@ -2681,21 +2681,24 @@ d_substitution (struct d_info *di, int prefix) ...@@ -2681,21 +2681,24 @@ d_substitution (struct d_info *di, int prefix)
c = d_next_char (di); c = d_next_char (di);
if (c == '_' || IS_DIGIT (c) || IS_UPPER (c)) if (c == '_' || IS_DIGIT (c) || IS_UPPER (c))
{ {
int id; unsigned int id;
id = 0; id = 0;
if (c != '_') if (c != '_')
{ {
do do
{ {
unsigned int new_id;
if (IS_DIGIT (c)) if (IS_DIGIT (c))
id = id * 36 + c - '0'; new_id = id * 36 + c - '0';
else if (IS_UPPER (c)) else if (IS_UPPER (c))
id = id * 36 + c - 'A' + 10; new_id = id * 36 + c - 'A' + 10;
else else
return NULL; return NULL;
if (id < 0) if (new_id < id)
return NULL; return NULL;
id = new_id;
c = d_next_char (di); c = d_next_char (di);
} }
while (c != '_'); while (c != '_');
...@@ -2703,7 +2706,7 @@ d_substitution (struct d_info *di, int prefix) ...@@ -2703,7 +2706,7 @@ d_substitution (struct d_info *di, int prefix)
++id; ++id;
} }
if (id >= di->next_sub) if (id >= (unsigned int) di->next_sub)
return NULL; return NULL;
++di->did_subs; ++di->did_subs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment