Skip to content

Fix Windows warnings#3

Open
Smit-create wants to merge 1 commit intoscipy:mainfrom
Smit-create:patch-1
Open

Fix Windows warnings#3
Smit-create wants to merge 1 commit intoscipy:mainfrom
Smit-create:patch-1

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);
      |                 ^~~~~~


/* 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