Skip to content

Error on arm32 #6

@mingodad

Description

@mingodad

Hello !
Testing your project with with the apk on android arm32 (nexus7) this program fail:

local ffi = require('ffi')
local buf = ffi.new('char[256]')
local c = ffi.C
ffi.cdef('int sprintf(char *buf, const char *fmt, ...);')
print(c.sprintf(buf, '%g', 5.3), ffi.string(buf));

Expected:

3    5.3

Output:

11   2.14609e+41

The above and the following are from the original test.lua and it also fail the following with segfault:

-- unsigned should be ignored for pointer rules
ffi.cdef([=[
int strncmp(const signed char *s1, const unsigned char *s2, size_t n);
]=]);
assert(ffi.C.strncmp("two", "three", 3) ~= 0); -- segfault here
...
-- Test io.tmpfile()
ffi.cdef ([=[
    int fprintf ( FILE * stream, const char * format, ... );
]=]);
local f = io.tmpfile();
ffi.C.fprintf(f, "test: %s\n", "foo"); -- segfault here

f:seek("set", 0);
local str = f:read('*l');
assert(str == 'test: foo', str);
f:close();

Commenting the above mentioned tests all the rest of test.lua pass.
Great work !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions