defctype and inner structs do not seem to play nicely

Bug #1172592 reported by Willem Rein Oudshoorn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
CFFI
New
Undecided
Unassigned

Bug Description

With the attached code, the following transcript shows the difference:

CL-USER> (ql:quickload "CFFI")
To load "cffi":
  Load 1 ASDF system:
    cffi
; Loading "cffi"
..
("CFFI")
CL-USER> (use-package "CFFI")
T
CL-USER> (load "/Users/woudshoo/Development/Source/Lisp-Outside-ASDF/cffi-bugs/struct-bug")
STYLE-WARNING: Undefined alien: "get_outer"
T
CL-USER> (setup)
#<FOREIGN-LIBRARY CFFI.O-943 "cffi.o">
CL-USER> (get-outer-works)
"Outer Translated, a = 1, b= <Inner Translated, a = 2, b= 3>"
CL-USER> (get-outer-bug)
"Outer Translated, a = 1, b= <#.(SB-SYS:INT-SAP #X0018E004)>"

The difference in the result is that in '(get-outer-works)' the inner struct is translated and
in the bug version it is not.

As far as I can tell the only relevant difference is in the declaration of the outer structs:

(defcstruct (outer-struct :class outer-struct-type)
  (a :int)
  (b (:struct inner-struct)))

vs

(defctype %bug-struct (:struct inner-struct))

(defcstruct (outer-struct-bug :class outer-struct-type-bug)
  (a :int)
  (b %bug-struct))

Revision history for this message
Willem Rein Oudshoorn (woudshoo+launchpad) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.