STR-484: strc: bizarre renaming problem with external definitions
Stratego:
————————————————–
module foo
imports liblib
strategiesmain =
iset-isect
————————————————–Compile:
————————————————–
martin@linux:~/tmp/bug-strc> strc -i foo.str
[ strc | info ] Compiling ‘foo.str’
[ strc | info ] Front-end succeeded : [user/system] = [3.62s/0.68s]
[ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.16s/0.07s]
[ strc | info ] Back-end succeeded : [user/system] = [0.17s/0.12s]
[ strc | error ] Command failed :
foo.c: In functionmain_0_0': foo.c:17: error:
iset’ undeclared (first use in this function)
foo.c:17: error: (Each undeclared identifier is reported only once
foo.c:17: error: for each function it appears in.)
————————————————–C:
————————————————–
ATerm main_0_0 (ATerm t)
{
t = iset-isect(t);
————————————————–liblib.str:
————————————————–
module liblib
imports
libstrategolib
libxtclib
————————————————–New try:
————————————————–
module foo
imports libstrategolib
strategiesmain =
iset-isect
————————————————–Compile:
————————————————–
martin@linux:~/tmp/bug-strc> strc -i foo.str
[ strc | info ] Compiling ‘foo.str’
[ strc | info ] Front-end succeeded : [user/system] = [2.20s/0.59s]
[ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.12s/0.07s]
[ strc | info ] Back-end succeeded : [user/system] = [0.16s/0.12s]
[ strc | error ] Command failed :
foo.c: In functionmain_0_0': foo.c:18: error: too few arguments to function
iset_isect_0_1’
————————————————–That’s right.
New try:
————————————————–
module foo
strategiesmain =
iset-isectexternal iset-isect(|t : ATerm())
external iset-isect(|t : ATerm())
————————————————–Compile:
————————————————–
martin@linux:~/tmp/bug-strc> strc -i foo.str
[ strc | info ] Compiling ‘foo.str’
[ strc | info ] Front-end succeeded : [user/system] = [0.30s/0.48s]
[ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.01s/0.05s]
[ strc | info ] Back-end succeeded : [user/system] = [0.15s/0.14s]
[ strc | error ] Command failed :
foo.c: In functionmain_0_0': foo.c:17: error:
iset’ undeclared (first use in this function)
foo.c:17: error: (Each undeclared identifier is reported only once
foo.c:17: error: for each function it appears in.)
————————————————–That’s wrong. Conclusion: in this case, strc cannot handle duplicate definitions of external symbols.
Submitted on 12 December 2005 at 23:21
Issue Log
STR-484, martin:
The problem is not in the renaming, but in needed-defs.The external definitions are simply collected and used a list in the input of the needed-defs algorithm. So, multiple external definitions can exist.
Later, the multiple definitions are joined, but this happends more than once because of the list input, so we still end up with multiple definitions!
Log in to post comments