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

Fix Windows warnings #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Smit-create
Copy link
Member

Related issue: rgommers/scipy#120

This PR aims to fix the following warning:

[516/1557] Compiling C object scipy/stats/_unuran/unuran_wrapper.cp39-win_amd64.pyd.p/.._..__lib_unuran_unuran_src_methods_mvtdr.c.obj
In file included from ../scipy/_lib/unuran/unuran/src/methods/mvtdr.c:330:
In function '_unur_mvtdr_etable_new',
    inlined from '_unur_mvtdr_triangulate' at ../scipy/_lib/unuran/unuran/src/methods/mvtdr_init.h:978:11:
../scipy/_lib/unuran/unuran/src/methods/mvtdr_init.h:1760:17: warning: argument 1 value '18446744073709551608' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
 1760 |   GEN->etable = malloc( size * sizeof(E_TABLE*) );
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ..\scipy\_lib\unuran\unuran\src/unur_source.h:71,
                 from ../scipy/_lib/unuran/unuran/src/methods/mvtdr.c:50:
../scipy/_lib/unuran/unuran/src/methods/mvtdr_init.h: In function '_unur_mvtdr_triangulate':
c:/rtools40/ucrt64/x86_64-w64-mingw32/include/stdlib.h:531:17: note: in a call to allocation function 'malloc' declared here
  531 |   void *__cdecl malloc(size_t _Size);
      |                 ^~~~~~

@@ -1757,7 +1757,7 @@ _unur_mvtdr_etable_new( struct unur_gen *gen, int size )
GEN->etable_size = size;

/* make root */
GEN->etable = malloc( size * sizeof(E_TABLE*) );
GEN->etable = malloc( size * sizeof(E_TABLE) );
Copy link
Member

@tirthasheshpatel tirthasheshpatel Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been changed in unuran 1.9.0. See #2.

GEN->etable is a E_TABLE ** so the change here doesn't seem like the correct fix. The warning thrown by GCC seems to be because of an implicit type conversion issue. Can you please try to build again with changes in #2 and check if the warning persists?

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

Successfully merging this pull request may close these issues.

2 participants