forked from pool/muparser
31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
|
From: Jan Engelhardt <jengelh@medozas.de>
|
||
|
Date: 2012-04-06 22:49:28.359430308 +0200
|
||
|
|
||
|
Resolve undefined behavior in muParserBase
|
||
|
|
||
|
./src/muParserBase.cpp:1041:85: warning: operation on 'sidx' may be undefined [-Wsequence-point]
|
||
|
./src/muParserBase.cpp:1041:85: warning: operation on 'sidx' may be undefined [-Wsequence-point]
|
||
|
|
||
|
I: Program causes undefined operation
|
||
|
(likely same variable used twiceand post/pre incremented in the same expression).
|
||
|
e.g. x = x++; Split it in two operations.
|
||
|
W: muparser sequence-point ./src/muParserBase.cpp:1041
|
||
|
---
|
||
|
src/muParserBase.cpp | 3 ++-
|
||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
||
|
Index: muparser-2.2.2/src/muParserBase.cpp
|
||
|
===================================================================
|
||
|
--- muparser-2.2.2.orig/src/muParserBase.cpp
|
||
|
+++ muparser-2.2.2/src/muParserBase.cpp
|
||
|
@@ -1038,7 +1038,8 @@ namespace mu
|
||
|
continue;
|
||
|
|
||
|
case cmPOW:
|
||
|
- Stack[--sidx] = MathImpl<value_type>::Pow(Stack[sidx], Stack[1+sidx]); ;
|
||
|
+ --sidx;
|
||
|
+ Stack[sidx] = MathImpl<value_type>::Pow(Stack[sidx], Stack[1+sidx]);
|
||
|
continue;
|
||
|
|
||
|
case cmLAND: --sidx; Stack[sidx] = Stack[sidx] && Stack[sidx+1]; continue;
|