Skip to content

Commit

Permalink
xl: Workaround double-free corruption from bad code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Atkins committed Apr 29, 2020
1 parent 2f32818 commit 5a3e6ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions testing/adios2/engine/SmallTestData.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <array>
#include <limits>
#include <string>
#include <vector>

#ifdef WIN32
#define NOMINMAX
Expand All @@ -20,8 +21,13 @@
struct SmallTestData
{
std::string S1 = "Testing ADIOS2 String type";
std::array<std::string, 1> S1array = {{"one"}};
std::array<std::string, 3> S3 = {{"one", "two", "three"}};

// These shoudl be able to use std::array like the rest of the pieces
// but the XL compiler seems to have some bad code generation surounding
// it that results in a double-free corruption. Switching to std::vector
// bypasses the problem
std::vector<std::string> S1array = {"one"};
std::vector<std::string> S3 = {"one", "two", "three"};

std::array<int8_t, 10> I8 = {{0, 1, -2, 3, -4, 5, -6, 7, -8, 9}};
std::array<int16_t, 10> I16 = {
Expand Down
5 changes: 3 additions & 2 deletions testing/adios2/engine/staging-common/TestData.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <array>
#include <limits>
#include <string>
#include <vector>

#ifdef WIN32
#define NOMINMAX
Expand All @@ -20,8 +21,8 @@
std::size_t Nx = 10;

std::string data_S1 = "Testing ADIOS2 String type";
std::array<std::string, 1> data_S1array = {{"one"}};
std::array<std::string, 3> data_S3 = {{"one", "two", "three"}};
std::vector<std::string> data_S1array = {"one"};
std::vector<std::string> data_S3 = {"one", "two", "three"};

std::vector<int8_t> data_I8;
std::vector<int16_t> data_I16;
Expand Down

0 comments on commit 5a3e6ef

Please sign in to comment.