Callback regression in Pharo 6 (60437)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Callback regression in Pharo 6 (60437)

Aliaksei Syrel
Callback instantiation: 

createCallback
   ^ FFICallback 
  signature: #(long (long))
  block: [ :value | value ]

C functions:

long test(long(*function)(long), long value) {
   return function(value); 
} 

#include <limits.h>
long long_min() {
   return LONG_MIN;
}

FFI calls:

primCall: aCallback long: aNumber
   ^ self ffiCall: #(long test(FFICallback aCallback, long aNumber))
 
primLongMin
   ^ self ffiCall: #(long long_min()) 

Test case:

test
  self 
    assert: (self primCall: self createCallback long: self primLongMin)
    equals: self primLongMin

self primLongMin returns -2147483648 (= LONG_MIN).
Result of callback is 0 => test fails.

P.S. works in Pharo 5

Cheers,
Alex