#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:


Same issue with C4.

 (import scheme)

 (define (bar x y) (display x y))

(module main () (import scheme mod)
        (define foo
          (lambda [x]
            (lambda (a)
              (if a
                  (bar x 'xxx)
                  (if x
                      (bar x 'yyy)
                      (bar x 'zzz)))

        (foo 'yo)
        (foo 'yo2)
#!/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 23 months ago by megane

No, it works with 4.13

comment:2 Changed 23 months ago by megane

Reverting 5d55f18857977c41a642161316e4cc497e333f5b "Catch runaway inlining" seems to fix it.

comment:3 Changed 22 months ago by sjamaan

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 22 months ago by megane

Resolution: fixed
Status: newclosed

Fixed with e28243f97cbfef618e3a5624f19c0af9dd98d6d6

Note: See TracTickets for help on using tickets.