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

Pointer casting mismatch in muParserTest.h #142

Open
mabraham opened this issue May 3, 2024 · 1 comment
Open

Pointer casting mismatch in muParserTest.h #142

mabraham opened this issue May 3, 2024 · 1 comment

Comments

@mabraham
Copy link

mabraham commented May 3, 2024

In several methods, e.g.
https://github.com/beltoforion/muparser/blob/master/include/muParserTest.h#L208

some pointer is cast to std::intptr_t before being returned as value_type, which as far as I can see is double. That looks risky. MSVC warns about the particular case of FunUd0 which casts a void* to std::intptr_t and then returns as value_type like

[104/1186 83.0/sec] Building CXX object _deps\muparser-build\CMakeFiles\muparser.dir\src\muParserTest.cpp.obj
..\src\external\muparser\include\muParserTest.h(210): warning C4244: 'return': conversion from 'intptr_t' to 'mu::value_type', possible loss of data

This is a minor problem for GROMACS, which bundles muParser, and would like to have a warning-free build with MSVC. How should we fix this? Can we avoid building source files that include this header, if it's only used in tests of muParser?

@beltoforion
Copy link
Owner

This is just test code you can safely omit it from compilation.

mabraham added a commit to mabraham/gromacs that referenced this issue May 13, 2024
The test code produces warnings with MSVC and avoiding the issue was
recommended at
beltoforion/muparser#142 (comment)
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

2 participants