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: get<long double> bad_variant_access #179

Closed
ax3l opened this issue May 17, 2018 · 3 comments
Closed

MSVC: get<long double> bad_variant_access #179

ax3l opened this issue May 17, 2018 · 3 comments
Assignees
Labels
bug machine/system machine & HPC system specific issues tests

Comments

@ax3l
Copy link
Member

ax3l commented May 17, 2018

Currently the following test fails with MSVC 19 (VS 14, 2015), probably due to it's double == long double implementation:

3: C:\projects\openpmd-api\test\SerialIOTest.cpp(845): FAILED:
3:   REQUIRE( s.getAttribute("longdouble").get< long double >() == 1.e80L )
3: due to unexpected exception with message:
3:   bad_variant_access
3: 
3: Datatype::UNDEFINED caught during dataset creation (serial HDF5)
3: ===============================================================================
3: test cases:  13 |  12 passed | 1 failed
3: assertions: 213 | 212 passed | 1 failed
3: 
 3/10 Test  #3: Serial.SerialIO ..................***Failed    0.41 sec
test 4
      Start  4: Serial.1_structure

Example in https://ci.appveyor.com/project/ax3l/openpmd-api/build/1.0.140/job/jo3nh9xgb03poikp

I think we should be able to emulate that behavior with gcc with the -mlong-double-64 switch (but from a first test this does not trigger it).

@ax3l ax3l self-assigned this May 17, 2018
@ax3l
Copy link
Member Author

ax3l commented May 18, 2018

@C0nsultant do you have an idea what could be causing this? I can also for now just quickly disable the long double reads on MSVC and we fix it after #63 is in.

@C0nsultant
Copy link
Member

C0nsultant commented May 18, 2018

Sorry, no obvious reason comes to mind. I would first check what the actual datatype that gets stored is:

#include <iostream>

#include <openPMD/backend/Attribute.hpp>
#include <openPMD/Datatype.hpp>

int main()
{
  long double ld = 0.;
  Attribute a(ld);
  std::cout << "Determined datatype: " << determineDatatype< long double >() << '\n'
            << "Stored datatype:     " << a.dtype << std::endl;
  return 0;
}

Depending on what this results in, we might have to disable long double conditionally.

@ax3l ax3l added the machine/system machine & HPC system specific issues label May 18, 2018
@ax3l
Copy link
Member Author

ax3l commented May 19, 2018

I pushed a demonstrator in #184

@ax3l ax3l closed this as completed in #184 Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug machine/system machine & HPC system specific issues tests
Projects
None yet
Development

No branches or pull requests

2 participants