Opened 9 years ago

Closed 9 years ago

#743 closed defect (invalid)

ccl::foreign-type-alignment returns incorrect alignment for :[un]signed-doubleword on x86

Reported by: sionescu Owned by: gb
Priority: normal Milestone:
Component: Foreign Function Interface Version: trunk
Keywords: Cc:

Description

Using 1.6-dev-r14265M-trunk (LinuxX8632):

(ccl::foreign-type-alignment (ccl::parse-foreign-type :signed-doubleword)) 64

The correct value is 32

Attachments (1)

long-long-alignment.c (229 bytes) - added by sionescu 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by sionescu

comment:1 Changed 9 years ago by gb

  • Owner set to gb

CCL::FOREIGN-TYPE-ALIGNMENT of a primitive type returns the natural alignment of that type.

Under most/all x8632 ABIs, a record field is aligned on a 32-bit boundary if its natural alignment is greater than 32 bits. (Vector types might be an exception to this; I don't remember.) CCL assumed that natural alignment was used in this case until r14222; that's now considered to be platform-specific.

? (def-foreign-type nil
    (:struct foo
       (:a :char)
       (:b :unsigned-doubleword)))
NIL
? (ccl::get-field-offset :foo.b)
4
#<FOREIGN-INTEGER-TYPE (:UNSIGNED 64) #x1413DCCE>
32

(in a post-r14222 trunk on x8632), which is consistent with what C returns here.

What's the bug, exactly ?

comment:2 Changed 9 years ago by rme

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.