Summary
Inlining issue
Metadata
- Id: b8985501aab80ac3edfbf29d63f9c9c9cea2d99f
- Trac id: 1665
- Type: defect
- Reporter: megane
- Owner:
- Cc:
- Status: closed
- Component: compiler
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: 5.2
- Version: 5.1.0
- Changetime: 2020-02-12 17:21:22 UTC
- Created: 2020-01-22 07:59:34 UTC
- Keywords: inline optimizer
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
Changes and comments
[2020-01-22 08:15:55 UTC] megane wrote:
No, it works with 4.13
[2020-01-22 08:31:27 UTC] megane wrote:
Reverting 5d55f18857977c41a642161316e4cc497e333f5b "Catch runaway inlining" seems to fix it.
[2020-02-10 14:40:26 UTC] sjamaan wrote:
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.
[2020-02-12 17:21:22 UTC] megane changed status from new to closed
[2020-02-12 17:21:22 UTC] megane set resolution to fixed
[2020-02-12 17:21:22 UTC] megane wrote:
Fixed with e28243f97cbfef618e3a5624f19c0af9dd98d6d6