Stratego:
--------------------------------------------------
module foo
imports liblib
strategies
main =
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 function `main_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
strategies
main =
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 function `main_0_0':
foo.c:18: error: too few arguments to function `iset_isect_0_1'
--------------------------------------------------
That's right.
New try:
--------------------------------------------------
module foo
strategies
main =
iset-isect
external 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 function `main_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.
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!