Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-484
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Martin Bravenboer
Reporter: Martin Bravenboer
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
Stratego/XT

strc: bizarre renaming problem with external definitions

Created: 2005-12-12 22:21   Updated: 2008-03-31 20:46
Component/s: strc - Stratego compiler
Affects Version/s: 0.16 (Stratego Core Compiler)
Fix Version/s: 0.17

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
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.

 All   Comments   Work Log   Change History      Sort Order:
Martin Bravenboer [2005-12-12 23:14]
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!