Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gfauto doesn't handle an integer with the minimum possible value properly #1078

Open
amakin-siru opened this issue Sep 30, 2020 · 1 comment

Comments

@amakin-siru
Copy link
Contributor

amakin-siru commented Sep 30, 2020

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)
@sneh19337
Copy link

I will be working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants