Skip to content

Conversation

@nirbheek
Copy link
Contributor

size_t is unsigned long int which is a 32-bit integer on 32-bit Windows. The multiplication in malloc() below then evaluates to a 32-bit integer which the compiler complains about.

This is normally a warning, but since we use -we4244 it's an error.

src/bench/graphene-bench-utils.c(175): error C4244: 'function': conversion from 'gint64' to 'size_t', possible loss of data`

The number of rounds will never exceed INT_MAX, so we can just use an int here.

@ebassi
Copy link
Owner

ebassi commented Dec 14, 2018

It seems this is failing to build with GCC on Linux, and with MINGW on Windows.

size_t is `unsigned long int` which is a 32-bit integer on 32-bit
Windows. The multiplication in malloc() then evaluates to a 32-bit
integer which the compiler complains about.

This is normally a warning, but since we use `-we4244` it's an error.

src/bench/graphene-bench-utils.c(175): error C4244: 'function': conversion from 'gint64' to 'size_t', possible loss of data`

The number of rounds will never exceed INT_MAX, so we can just use an
int here.
@nirbheek nirbheek force-pushed the fix-32bit-int-conversion-error branch from 94286b8 to 28800bb Compare December 14, 2018 11:23
@nirbheek
Copy link
Contributor Author

Oof. I should've tested on Linux first. Should be fixed now.

@ebassi ebassi merged commit bb007b7 into ebassi:master Dec 14, 2018
@nirbheek nirbheek deleted the fix-32bit-int-conversion-error branch July 13, 2020 12:59
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