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

MSVC: Add –d2UndefIntOverflow– #1396

Open
jedisct1 opened this issue Jul 31, 2024 · 2 comments
Open

MSVC: Add –d2UndefIntOverflow– #1396

jedisct1 opened this issue Jul 31, 2024 · 2 comments

Comments

@jedisct1
Copy link
Owner

When using zig/clang/gcc, we unconditionally enable -fwrapv in order make overflowing signed operations well defined.

But this is not the case when using MSVC.

–d2UndefIntOverflow– is a compiler flag equivalent to -fwrapv: https://devblogs.microsoft.com/cppblog/new-code-optimizer/

We should figure out how to enable it in the Visual Studio solutions.

@jedisct1
Copy link
Owner Author

Does anybody know how to do this?

@GPUex
Copy link

GPUex commented Oct 22, 2024

Well tried using latest VS 2022: Project properties -> C/C++ -> Command line -> added /d2UndefIntOverflow-
But on got compile error: Error C1007 unrecognized flag '-UndefIntOverflow-' in 'p2'
So it seems it's no longer valid flag, unless I'm missing something .

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

No branches or pull requests

2 participants