diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-12-01 20:49:46 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-12-01 20:49:46 -0800 |
commit | 05edb250ee309400ddcbc287a98d2e83004ca8b2 (patch) | |
tree | f410308083e7b166dad81c4fd96af9ccc0f8da93 /src | |
parent | e3524c90de918d0b4a74d70768175561758f0d70 (diff) |
Work around cray++ compiler issue
It's still not clear as to what exactly makes it emit this error when compiling
string_to_integer:
CC-3059 crayc++: INTERNAL __C_FILE_SCOPE_DATA__, File = <pugixml>/src/pugixml.cpp, Line = 4524, Column = 4
Expected no overflow in routine.
But a viable workaround for now is to exploit the knowledge that it uses
two-complement arithmetics and invert the sign manually.
Fixes #125.
Diffstat (limited to 'src')
-rw-r--r-- | src/pugixml.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index cac51a5..d379a23 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4521,7 +4521,14 @@ PUGI__NS_BEGIN } if (negative) + { + // Workaround for crayc++ CC-3059: Expected no overflow in routine. + #ifdef _CRAYC + return (overflow || result > minneg) ? ~minneg + 1 : ~result + 1; + #else return (overflow || result > minneg) ? 0 - minneg : 0 - result; + #endif + } else return (overflow || result > maxpos) ? maxpos : result; } |