Opened 6 years ago
Closed 6 years ago
#1665 closed defect (fixed)
Inlining issue
| Reported by: | megane | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 5.2 |
| Component: | compiler | Version: | 5.1.0 |
| Keywords: | inline optimizer | Cc: | |
| Estimated difficulty: |
Description
Same issue with C4.
::::::::::::::
mod.scm
::::::::::::::
(module
mod
(bar)
(import scheme)
(define (bar x y) (display x y))
)
::::::::::::::
main.scm
::::::::::::::
(module main () (import scheme mod)
(define foo
(lambda [x]
(lambda (a)
(if a
(bar x 'xxx)
(if x
(bar x 'yyy)
(bar x 'zzz)))
1)))
(foo 'yo)
(foo 'yo2)
)
::::::::::::::
run.sh
::::::::::::::
#!/usr/bin/env bash
set -euo pipefail
rm -f *.o *.c *.inline *.import.*
csc -c mod.scm -J -unit mod -oi mod.inline
csc -inline-global main.scm -uses mod mod.o
# $ ./run.sh
# main.c: In function ‘f_251’:
# main.c:261:1: warning: implicit declaration of function ‘f_230’; did you mean ‘f_238’? [-Wimplicit-function-declaration]
# f_230(4,av2);}}}}
# ^~~~~
# f_238
# main.c:261:1: warning: ‘noreturn’ function does return
# f_230(4,av2);}}}}
# ^~~~~
# main.o: In function `f_251':
# main.c:(.text+0x8ee): undefined reference to `f_230'
# collect2: error: ld returned 1 exit status
Change History (4)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
Reverting 5d55f18857977c41a642161316e4cc497e333f5b "Catch runaway inlining" seems to fix it.
comment:3 Changed 6 years ago by
Originally, the entire call to the procedure would be inlined, thus the f_230 id disappears as it is no longer needed. Currently, the unroll limit prevents this from happening.
So the underlying bug looks like an older one, but it's triggered by the addition of an unroll limit.
comment:4 Changed 6 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed with e28243f97cbfef618e3a5624f19c0af9dd98d6d6
Note: See
TracTickets for help on using
tickets.

No, it works with 4.13