graphicsfuzz
graphicsfuzz copied to clipboard
gfauto doesn't handle an integer with the minimum possible value properly
If an input shader includes an integer variable with the minimum possible value, gfauto doesn't handle it properly.
The reason for this behavior is that the visitUnaryExpr
method in StandardVisitor
passes the integer without the sign to the LiteralToUniformReductionOpportunity
class and the positive value goes out of range.
Here's a stacktrace which is the result of having the value -2147483648
in one of the unit tests:
java.lang.NumberFormatException: For input string: "2147483648"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:587)
at java.lang.Integer.parseInt(Integer.java:615)
at com.graphicsfuzz.common.ast.expr.IntConstantExpr.getNumericValue(IntConstantExpr.java:48)
at com.graphicsfuzz.reducer.reductionopportunities.LiteralToUniformReductionOpportunity.applyReductionImpl(LiteralToUniformReductionOpportunity.java:70)
at com.graphicsfuzz.reducer.reductionopportunities.AbstractReductionOpportunity.applyReduction(AbstractReductionOpportunity.java:39)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at com.graphicsfuzz.reducer.reductionopportunities.LiteralToUniformReductionOpportunitiesTest.testReplaceSimpleInt(LiteralToUniformReductionOpportunitiesTest.java:80)
I will be working on this