summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-31 17:38:38 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-31 17:38:38 +0000
commita8c4f791cafca77348c20a017d3509b0b743750e (patch)
tree6690f1a6b537c7958197d07ab440c51f5c343ac7 /libiberty
parentb079a2076830e2cc0d28c75cc778985bd64ce70c (diff)
downloadgcc-a8c4f791cafca77348c20a017d3509b0b743750e.tar.gz
* cp-demangle.c (d_substitution): Correct overflow check to avoid
-fstrict-overflow optimizations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133761 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/cp-demangle.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index c85691c40e1..0e8424d56e8 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+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>
* configure.ac (frags): Don't set, use frag instead.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index edcfedca7a5..71a28ab539b 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2681,21 +2681,24 @@ d_substitution (struct d_info *di, int prefix)
c = d_next_char (di);
if (c == '_' || IS_DIGIT (c) || IS_UPPER (c))
{
- int id;
+ unsigned int id;
id = 0;
if (c != '_')
{
do
{
+ unsigned int new_id;
+
if (IS_DIGIT (c))
- id = id * 36 + c - '0';
+ new_id = id * 36 + c - '0';
else if (IS_UPPER (c))
- id = id * 36 + c - 'A' + 10;
+ new_id = id * 36 + c - 'A' + 10;
else
return NULL;
- if (id < 0)
+ if (new_id < id)
return NULL;
+ id = new_id;
c = d_next_char (di);
}
while (c != '_');
@@ -2703,7 +2706,7 @@ d_substitution (struct d_info *di, int prefix)
++id;
}
- if (id >= di->next_sub)
+ if (id >= (unsigned int) di->next_sub)
return NULL;
++di->did_subs;