diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java index 51200dd1cf40613c23a7d68ef8b432764d1a3eec..501e831a8fe65bc24ea6d8ac9dec3e59c78340ba 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java @@ -496,7 +496,7 @@ abstract class VectorMapBinaryInternalNode extends RBaseNode { @Cached("createCountingProfile()") LoopConditionProfile leftProfile, @Cached("createCountingProfile()") LoopConditionProfile rightProfile, @Cached("createBinaryProfile()") ConditionProfile smallRemainderProfile) { - assert result != right; + assert result != right || rightLength == leftLength; leftProfile.profileCounted(leftLength); rightProfile.profileCounted(rightLength); while (leftProfile.inject(leftIter.getIndex() + 1 < leftLength)) { @@ -527,7 +527,7 @@ abstract class VectorMapBinaryInternalNode extends RBaseNode { @Cached("createCountingProfile()") LoopConditionProfile leftProfile, @Cached("createCountingProfile()") LoopConditionProfile rightProfile, @Cached("createBinaryProfile()") ConditionProfile smallRemainderProfile) { - assert result != left; + assert result != left || rightLength == leftLength; leftProfile.profileCounted(leftLength); rightProfile.profileCounted(rightLength); while (rightProfile.inject(rightIter.getIndex() + 1 < rightLength)) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index b1bc38b64be0efeffb3e466b46e68d2618ff880c..589957931b9e004908c86a8c8e179fa72438065d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -361,6 +361,9 @@ public class RRuntime { @TruffleBoundary public static int parseInt(String s) { int length = s.length(); + if (length == 0) { + throw new NumberFormatException(); + } long value = 0; if (s.charAt(0) == '-') { if (length == 1) { @@ -379,9 +382,6 @@ public class RRuntime { } return (int) -value; } else { - if (length == 0) { - throw new NumberFormatException(); - } int pos = 0; while (pos < length) { char ch = s.charAt(pos++); @@ -400,6 +400,9 @@ public class RRuntime { @TruffleBoundary public static int parseIntWithNA(String s) { int length = s.length(); + if (length == 0) { + return INT_NA; + } long value = 0; if (s.charAt(0) == '-') { if (length == 1) { @@ -418,9 +421,6 @@ public class RRuntime { } return (int) -value; } else { - if (length == 0) { - return INT_NA; - } int pos = 0; while (pos < length) { char ch = s.charAt(pos++);