Opened 16 years ago

Closed 16 years ago

#156 closed defect (fixed)

ClassCastException in TreeParser

Reported by: Stephen Siegel Owned by: ywei
Priority: major Milestone: Release 1.0
Component: front Version: 1.0
Keywords: front TreeParser Cc:

Description

Attempting to run laplace.Laplace1Test, I get this exception. Not sure which line of code is being parsed here....

java.lang.ClassCastException: edu.udel.cis.vsl.minimp.front.minimp.ast.type.PointerType cannot be cast to edu.udel.cis.vsl.minimp.front.minimp.ast.type.ArrayType
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processLhs(TreeParser.java:1887)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processPrimaryExpr(TreeParser.java:1264)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processPostfixExpr(TreeParser.java:1181)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processUnaryExpr(TreeParser.java:1132)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processMultiplicativeExpr(TreeParser.java:1074)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processAdditiveExpr(TreeParser.java:1019)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processRelationalExpr(TreeParser.java:951)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processEqualityExpr(TreeParser.java:895)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processLogicalAndExpr(TreeParser.java:861)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processLogicalOrExpr(TreeParser.java:826)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processAssignExpr(TreeParser.java:725)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processAssignmentStmt(TreeParser.java:1435)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStatement(TreeParser.java:1384)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processLoopStmt(TreeParser.java:1613)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processIterativeStmt(TreeParser.java:1530)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStatement(TreeParser.java:1396)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStatementList(TreeParser.java:1474)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processCompoundStmt(TreeParser.java:1459)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStatement(TreeParser.java:1390)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processLoopStmt(TreeParser.java:1613)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processIterativeStmt(TreeParser.java:1530)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStatement(TreeParser.java:1396)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processStmtList(TreeParser.java:692)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processFunctionBody(TreeParser.java:656)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processFunction(TreeParser.java:507)
	at edu.udel.cis.vsl.minimp.front.minimp.parser.TreeParser.processAST(TreeParser.java:180)
	at edu.udel.cis.vsl.minimp.front.minimp.ModelExtractor.extractPair(ModelExtractor.java:42)
	at edu.udel.cis.vsl.minimp.front.minimp.ModelExtractor.extractModelPair(ModelExtractor.java:61)
	at laplace.Laplace1Test.setUpBeforeClass(Laplace1Test.java:43)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Change History (3)

comment:1 by ywei, 16 years ago

Status: newaccepted

comment:2 by ywei, 16 years ago

The source is at line 127 in file laplaceImpl_2_2.mmp: grid[s][i]=grid_data[s]+i*nx; grid is a 1-dimensional array, so the second subscript [i] is actually a dereference expression, but the TreeParser couldn't tell it from an array subscript expression because it processes the subscripts within a loop. I am working on a fix now.

comment:3 by ywei, 16 years ago

Resolution: fixed
Status: acceptedclosed

I modified the tree parser to handle the mixed situation. It doesn't throw the exception now. But the source program still have other syntax errors.

Note: See TracTickets for help on using tickets.