Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007720 [Squeak] VM minor always 01-19-13 01:37 01-23-13 09:07
Reporter nicolas cellier View Status public  
Assigned To lewis
Priority normal Resolution open  
Status assigned   Product Version trunk
Summary 0007720: FFI silently accept a 64bits argument > LLONG_MAX instead of failing
Description 1. Create a FFI call to a function taking a signed long long (64 bits) integer
2. Call the function with (1<<63)

A well behaved FFIPlugin should fail, because 1<<63 is greater than maximal representable signed long long (presumably 1<<63-1 in two complement).

But instead of failing, FFI interpret 1<<63 as a negative int, which is a bad feature.
Additional Information This is caused by FFIPlugin>>#ffiPushSignedLongLongOop: which omit to test this case of LLONG_MAX overflow...

Note that COG version (ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in:) is correct because it uses #signed64BitValueOf:
Attached Files

- Relationships
related to 0007237acknowledged lewis Make FFI work on 64 bit platforms 

- Notes
(0014296 - 355 - 391 - 603 - 603 - 603 - 603)
nicolas cellier
01-23-13 09:07

Note that http://smalltalkhub.com/mc/nice/NiceVMExperiments/main/VMMaker.oscog-nice.275.mcz [^] contains an idea of correction for FFIPlugin>>ffiPushSignedLongLongOop:

signed/unsigned word agnostic could be:

((highWord bitAnd: 16r80000000) = 0 or: [negative and: [lowWord = 0 and: [(highWord
bitXor: 16r80000000) = 0]) ifFalse: [ ffi coercion failed ]
 

- Issue History
Date Modified Username Field Change
01-19-13 01:37 nicolas cellier New Issue
01-19-13 01:37 nicolas cellier Status new => assigned
01-19-13 01:37 nicolas cellier Assigned To  => lewis
01-22-13 13:36 lewis Relationship added related to 0007237
01-23-13 09:07 nicolas cellier Note Added: 0014296


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
39 total queries executed.
31 unique queries executed.
Powered by Mantis Bugtracker