STR-52: Illegal C code for mutual recursive strategies defined in a let
Test program:
———————————-
module foo
imports list-cons
strategiesmain =
let-testlet-test =
let P = ![1 | <Q>]
Q = ![2 | <R>]
R = ![3]
in P
end
———————————-
- Compile:
- ———————————-
- martin@logistico:~> strc -i foo.str -O 2
- compiling foo.str
- front-end succeeded: user 0.18 system 0.76
- optimization succeeded: user 0.02 system 0.29
- back-end succeeded: user 0.09 system 0.40
- foo.c: In function `g_0’:
- foo.c:54: warning: assignment makes pointer from integer without a cast
- foo.c: In function `let_test_0_0’:
- foo.c:63: warning:
i_0' was declared implicitly
extern’ and later `static’- foo.c:54: warning: previous declaration of `i_0’
- foo.c:63: warning: type mismatch with previous implicit declaration
- foo.c:54: warning: previous implicit declaration of `i_0’
- foo.o(.text+0x1c9): In function `g_0.0’:
undefined reference to `i_0’
collect2: ld returned 1 exit status
compilation failed (1.96 secs)Without the -O 2 argument the problem is gone, but if the strategies are more complex the issue returns (probably related to inlining at higher opt levels).
Submitted on 18 April 2004 at 15:11
Issue Log
On 28 May 2004 at 11:02 Jira commented:
STR-52, martin:
An smaller test:
—————————–
module foo
imports tuple-cons
strategiesmain =
let p = q <+ p
q = r <+ q
r = !1 <+ r
in p
end
—————————–Declarations are local to a block as well. I’m surprised that this hasn’t caused any problems yet. Will try this out.
Log in to post comments