From 05edb250ee309400ddcbc287a98d2e83004ca8b2 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 1 Dec 2016 20:49:46 -0800 Subject: 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 = /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. --- src/pugixml.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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; } -- cgit v1.2.3