[Armedbear-devel] flet+inline warns and generate bad code.

Pascal J. Bourguignon pjb at informatimago.com
Sat Feb 21 02:42:26 UTC 2015


An inline flet makes the compiler report an error (warning?):

(defun f (x)
  (flet ((hello (x) (logand x #xffffffff)))
    (declare (inline hello))
    (hello (+ (hello 1) (hello x)))))


CL-USER(6): (compile-file #P"~/abcl-flet-bug.lisp")
; Compiling /home/pjb/abcl-flet-bug.lisp ...
; (DEFUN F ...)
; (DEFUN G ...)

; Compilation unit finished
;   The following functions were used but not defined:
;     HELLO

; Wrote /home/pjb/abcl-flet-bug.abcl (0.04 seconds)
#P"/home/pjb/abcl-flet-bug.abcl"
NIL
NIL


And the code generated is wrong:

CL-USER(12): (load(compile-file #P"~/abcl-flet-bug.lisp"))
; Compiling /home/pjb/abcl-flet-bug.lisp ...
; (DEFUN F ...)

; Compilation unit finished
;   The following functions were used but not defined:
;     HELLO

; Wrote /home/pjb/abcl-flet-bug.abcl (0.012 seconds)
T
CL-USER(13): (f 4)
#<THREAD "interpreter" {6A4E43EA}>: Debugger invoked on condition of type UNDEFINED-FUNCTION
  The function HELLO is undefined.
Restarts:
  0: CONTINUE     Try again.
  1: USE-VALUE    Specify a function to call instead.
  2: RETURN-VALUE Return one or more values from the call to HELLO.
  3: TOP-LEVEL    Return to top level.
[1] CL-USER(14): 3
CL-USER(15): 



Without inline, it works well.


CL-USER(15): (load(compile-file #P"~/abcl-flet-bug.lisp"))
; Compiling /home/pjb/abcl-flet-bug.lisp ...
; (DEFUN F ...)
; Wrote /home/pjb/abcl-flet-bug.abcl (0.02 seconds)
T
CL-USER(16): (f 4)
5
CL-USER(17): 



CL-USER(11): (COM.INFORMATIMAGO.TOOLS.MANIFEST:PRINT-BUG-REPORT-INFO)


LISP-IMPLEMENTATION-TYPE     "Armed Bear Common Lisp"
LISP-IMPLEMENTATION-VERSION  "1.3.1"
SOFTWARE-TYPE                "Linux"
SOFTWARE-VERSION             "3.2.0-4-amd64"
MACHINE-INSTANCE             "kuiper"
MACHINE-TYPE                 "X86-64"
MACHINE-VERSION              "Intel(R) Core(TM) i7 CPU         950  @ 3.07GHz"
distribution                 (:LINUX :DEBIAN "7.8")
uname -a                     NIL
*FEATURES*                   (:COM.INFORMATIMAGO.PJB :SPLIT-SEQUENCE
                              :CLOSER-MOP
                              :COM.INFORMATIMAGO.COMMON-LISP.LISP.CL-STEPPER
                              :NEWLINE-IS-LINEFEED :HAS-ASCII-CODE :HAS-VT
                              :HAS-BELL :HAS-ESCAPE :HAS-LINEFEED :HAS-RETURN
                              :HAS-BACKSPACE :HAS-TAB :HAS-PAGE :HAS-RUBOUT
                              :QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3
                              :ASDF2 :ASDF :OS-UNIX :ASDF-UNICODE
                              :ABCL-BUNDLE-OP-SUPPORTED :X86-64 :JAVA-1.7 :UNIX
                              :LINUX :ARMEDBEAR :ABCL :COMMON-LISP :ANSI-CL
                              :CDR6 :MOP :PACKAGE-LOCAL-NICKNAMES)




/proc/cpuinfo
-------------

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 26
model name	: Intel(R) Core(TM) i7 CPU         950  @ 3.07GHz
stepping	: 5
microcode	: 0x11
cpu MHz		: 3073.461
cache size	: 8192 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips	: 6146.92
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:


CL-USER(12): 


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


_______________________________________________
Armedbear-devel mailing list
Armedbear-devel at common-lisp.net
https://mailman.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel


More information about the armedbear-devel mailing list