From: Andrea Cilio <A.Cilio@et.tudelft.nl>
Date: Thu, 01 May 1997 13:01:03 +0200
Subject: new_unique_var method
Message-Id: <336877EF.F2@et.tudelft.nl>
Hello,
I found a bug in new_unique_var method: it always appends
a unique number to the variable name, even if the name is
unique. I don't know if this is the desired behaviour, but
the suif library documentation says that the number is
appended only if the name passed isn't unique.
Here is the patch:
-8<------------------------------------------8<--
*** symtab.cc.old Tue May 7 22:37:52 1996
--- symtab.cc Thu May 1 12:47:31 1997
***************
*** 324,333 ****
/* provide a default base for the variable name */
if (!base) base = "suif_tmp";
/* add a number to the base name and make sure it's unique */
! while (TRUE) {
sprintf(bfr, "%s%u", base, var_counter++);
- if (!lookup_var(bfr, FALSE)) break;
}
return new_var(t, bfr);
--- 324,333 ----
/* provide a default base for the variable name */
if (!base) base = "suif_tmp";
+ sprintf(bfr, base);
/* add a number to the base name and make sure it's unique */
! while (!lookup_var(bfr, FALSE)) {
sprintf(bfr, "%s%u", base, var_counter++);
}
return new_var(t, bfr);
-8<------------------------------------------8<--
Best regards,
-- Andrea
Technical University of Delft
Computer Architecture and Digital Techniques Lab
A.Cilio@et.tudelft.nl