Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build on x32 has "pointer cast size mismatch" #444

Closed
dod38fr opened this issue Nov 29, 2016 · 5 comments
Closed

build on x32 has "pointer cast size mismatch" #444

dod38fr opened this issue Nov 29, 2016 · 5 comments
Assignees
Labels

Comments

@dod38fr
Copy link
Contributor

dod38fr commented Nov 29, 2016

Hello

x32 build log of Debian moarvm build show some pointer-cast-size-mismatch warnings. This may hint at bugs in some corner case.

Can you fix this ?

All the best

@samcv
Copy link
Member

samcv commented Nov 14, 2018

Closing this since i'm assuming it's been fixed. Please reopen if this is actually still an issue.

@samcv samcv closed this as completed Nov 14, 2018
@dod38fr
Copy link
Contributor Author

dod38fr commented Nov 14, 2018

@samcv Build logs shows that this issue still occurs on armel, armhf, i386, kfreebsd-i386, mips, mipsel, powerpc architectures.

E.g. on armhf:

gcc -c -Werror=declaration-after-statement -Werror=pointer-arith -O3 -DNDEBUG -g3  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI -fPIC -DDEBUG_HELPERS -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/moarvm-2018.09+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DMVM_TRACING=0 -DMVM_CGOTO=1 -DMVM_RDTSCP=0 -DMVM_BUILD_SHARED -fPIC -I3rdparty/sha1 -I3rdparty/tinymt -I3rdparty/dynasm -I3rdparty/cmp -I3rdparty -Isrc -o src/core/exceptions.o src/core/exceptions.c
src/core/exceptions.c: In function 'handler_can_handle':
src/core/exceptions.c:85:57: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     MVMuint64           block_label = block_has_label ? (MVMuint64)(f->work[fh->label_reg].o) : 0;
                                                         ^
src/core/exceptions.c:86:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     MVMuint64          thrown_label = payload ? (MVMuint64)payload : 0;
                                                 ^
gcc -c -Werror=declaration-after-statement -Werror=pointer-arith -O3 -DNDEBUG -g3  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI -fPIC -DDEBUG_HELPERS -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/moarvm-2018.09+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DMVM_TRACING=0 -DMVM_CGOTO=1 -DMVM_RDTSCP=0 -DMVM_BUILD_SHARED -fPIC -I3rdparty/sha1 -I3rdparty/tinymt -I3rdparty/dynasm -I3rdparty/cmp -I3rdparty -Isrc -o src/core/interp.o src/core/interp.c
src/core/interp.c: In function 'MVM_interp_run':
src/core/interp.c:1906:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                 GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).o;
                                          ^
src/core/interp.c:6022:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
                 char      *cache    = (char *)MVM_BC_get_I64(cur_op, 12);
                                       ^

@samcv
Copy link
Member

samcv commented Nov 14, 2018

Ok thanks. I'm going to reopen this.

@samcv samcv reopened this Nov 14, 2018
@samcv samcv self-assigned this Nov 14, 2018
@samcv samcv added the warnings label Nov 14, 2018
@samcv samcv closed this as completed in 6ff60a3 Nov 25, 2018
@samcv
Copy link
Member

samcv commented Nov 25, 2018

@dod38fr looks like github closed automatically.. Regardless it is hopefully fixed with 6ff60a3

Let me know if it isn't.

@dod38fr
Copy link
Contributor Author

dod38fr commented Dec 2, 2018

@samcv the issue was automatically closed by GitHub because the commit message of 6ff60a3 contain "resolve #<bug_number>". See https://help.github.com/articles/closing-issues-using-keywords/ for other ways to resolve an issue with a commit message.

The warnings mentioned in this bug are gone. However, build log of 2018.11 on x32 has other similar warnings:

gcc -c -Werror=declaration-after-statement -Werror=pointer-arith -O3 -DNDEBUG -g3  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI -fPIC -DDEBUG_HELPERS -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/moarvm-2018.11+dfsg=. -specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DMVM_TRACING=0 -DMVM_CGOTO=1 -DMVM_RDTSCP=1 -DMVM_BUILD_SHARED -fPIC -I/usr/local/include -I3rdparty/sha1 -I3rdparty/tinymt -I3rdparty/dynasm -I3rdparty/cmp -I3rdparty -Isrc -o src/core/nativecall_libffi.o src/core/nativecall_libffi.c
In file included from src/moar.h:140,
                 from src/core/nativecall_libffi.c:1:
src/core/nativecall_libffi.c: In function 'MVM_nativecall_invoke':
src/core/nativecall_libffi.c:474:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         result = make_fun(tc, res_type, (c_type)ret); \
                                         ^
src/gc/roots.h:76:5: note: in definition of macro 'MVMROOT2'
     block \
     ^~~~~
src/core/nativecall_libffi.c:674:21: note: in expansion of macro 'handle_ret'
                     handle_ret(tc, void *, ffi_arg, MVM_nativecall_make_cstruct);
                     ^~~~~~~~~~
src/core/nativecall_libffi.c:474:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         result = make_fun(tc, res_type, (c_type)ret); \
                                         ^
src/gc/roots.h:76:5: note: in definition of macro 'MVMROOT2'
     block \
     ^~~~~
src/core/nativecall_libffi.c:677:21: note: in expansion of macro 'handle_ret'
                     handle_ret(tc, void *, ffi_arg, MVM_nativecall_make_cppstruct);
                     ^~~~~~~~~~
src/core/nativecall_libffi.c:474:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         result = make_fun(tc, res_type, (c_type)ret); \
                                         ^
src/gc/roots.h:76:5: note: in definition of macro 'MVMROOT2'
     block \
     ^~~~~
src/core/nativecall_libffi.c:680:21: note: in expansion of macro 'handle_ret'
                     handle_ret(tc, void *, ffi_arg, MVM_nativecall_make_cpointer);
                     ^~~~~~~~~~
src/core/nativecall_libffi.c:474:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         result = make_fun(tc, res_type, (c_type)ret); \
                                         ^
src/gc/roots.h:76:5: note: in definition of macro 'MVMROOT2'
     block \
     ^~~~~
src/core/nativecall_libffi.c:683:21: note: in expansion of macro 'handle_ret'
                     handle_ret(tc, void *, ffi_arg, MVM_nativecall_make_carray);
                     ^~~~~~~~~~
src/core/nativecall_libffi.c:474:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         result = make_fun(tc, res_type, (c_type)ret); \
                                         ^
src/gc/roots.h:76:5: note: in definition of macro 'MVMROOT2'
     block \
     ^~~~~
src/core/nativecall_libffi.c:686:21: note: in expansion of macro 'handle_ret'
                     handle_ret(tc, void *, ffi_arg, MVM_nativecall_make_cunion);
                     ^~~~~~~~~~
[snip]
gcc -c -Werror=declaration-after-statement -Werror=pointer-arith -O3 -DNDEBUG -g3  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DHAVE_LIBFFI -fPIC -DDEBUG_HELPERS -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/moarvm-2018.11+dfsg=. -specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DMVM_TRACING=0 -DMVM_CGOTO=1 -DMVM_RDTSCP=1 -DMVM_BUILD_SHARED -fPIC -I/usr/local/include -I3rdparty/sha1 -I3rdparty/tinymt -I3rdparty/dynasm -I3rdparty/cmp -I3rdparty -Isrc -o src/6model/reprs/VMArray.o src/6model/reprs/VMArray.c
src/6model/reprs/VMArray.c: In function 'read_buf':
src/6model/reprs/VMArray.c:900:82: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'MVMint64' {aka 'long long int'} [-Wformat=]
         MVM_exception_throw_adhoc(tc, "MVMArray: read_buf out of bounds offset %ld start %ld elems %lu count %lu", offset, start, body->elems, count);
                                                                                ~~^                                 ~~~~~~
                                                                                %lld
src/6model/reprs/VMArray.c:900:92: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'MVMint64' {aka 'long long int'} [-Wformat=]
         MVM_exception_throw_adhoc(tc, "MVMArray: read_buf out of bounds offset %ld start %ld elems %lu count %lu", offset, start, body->elems, count);
                                                                                          ~~^                               ~~~~~
                                                                                          %lld
src/6model/reprs/VMArray.c:900:102: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'MVMuint64' {aka 'long long unsigned int'} [-Wformat=]
         MVM_exception_throw_adhoc(tc, "MVMArray: read_buf out of bounds offset %ld start %ld elems %lu count %lu", offset, start, body->elems, count);
                                                                                                    ~~^                            ~~~~~~~~~~~
                                                                                                    %llu
src/6model/reprs/VMArray.c:900:112: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'MVMuint64' {aka 'long long unsigned int'} [-Wformat=]
         MVM_exception_throw_adhoc(tc, "MVMArray: read_buf out of bounds offset %ld start %ld elems %lu count %lu", offset, start, body->elems, count);
                                                                                                              ~~^                               ~~~~~
                                                                                                              %llu

and fails with:

src/math/bigintops.c: In function 'MVM_bigint_rand':
src/math/bigintops.c:1166:13: error: 'MP_GEN_RANDOM_MAX' undeclared (first use in this function); did you mean 'MP_GEN_RANDOM'?
         if (MP_GEN_RANDOM_MAX >= abs(smallint_max)) {
             ^~~~~~~~~~~~~~~~~
             MP_GEN_RANDOM
src/math/bigintops.c:1166:13: note: each undeclared identifier is reported only once for each function it appears in

On the other hand, the build failure may be due to the fact that Debian compile moar with the last released version of libtommath, not from a later git commit as done by moar. I've asked libtommath for a new release

All the best

cc @robertlemmen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants