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

[Bug] Build fails on 32-bit platforms: overflow in expression; result is -64771072 with type 'long' #449

Open
1 of 2 tasks
yurivict opened this issue Oct 6, 2024 · 3 comments

Comments

@yurivict
Copy link

yurivict commented Oct 6, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Version

3.6.0

Minimal reproduce step

build on 32-bit platform

What did you expect to see?

n/a

What did you see instead?

In file included from /wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfiguration.cc:22:
/wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfigurationImpl.h:33:65: error: overflow in expression; result is -64771072 with type 'long' [-Werror,-Winteger-overflow]
   33 |     std::chrono::nanoseconds operationTimeout{30L * 1000 * 1000 * 1000};
      |                                               ~~~~~~~~~~~~~~~~~~^~~~~~
/wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfigurationImpl.h:33:65: error: overflow in expression; result is -64771072 with type 'long' [-Werror,-Winteger-overflow]
   33 |     std::chrono::nanoseconds operationTimeout{30L * 1000 * 1000 * 1000};
      |                                               ~~~~~~~~~~~~~~~~~~^~~~~~
2 errors generated.

Anything else?

log

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@lhotari
Copy link
Member

lhotari commented Oct 6, 2024

build on 32-bit platform

@yurivict what hardware are you targeting?

@yurivict
Copy link
Author

yurivict commented Oct 6, 2024

On FreeBSD we run 32 builds for i386 and arm7.
i386 binaries can also run on 64-bit systems on FreeBSD and Linux.
This isn't particularly practical, but this is done in part to catch bugs this these.

@BewareMyPower
Copy link
Contributor

I think we should not use long here because long is not portable. We should use unsigned long long or the types from stdint.h

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

No branches or pull requests

3 participants