Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353319 - IRs misrepresent decrement loops
Summary: IRs misrepresent decrement loops
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 352030
  Show dependency tree
 
Reported: 2011-07-28 08:55 EDT by Scott Greer CLA
Modified: 2017-02-23 14:16 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Greer CLA 2011-07-28 08:55:44 EDT
This FVT test

		// Test default exit within FOR loop
		for ( counter from 5 to stop by 1)
			total = total + counter;
			exit;
		end


is incorrectly represent as an incrementing for loop in the IR;  as a result, both Java and JavaGen generate the wrong code:

			<statements ID="180" eClass="org.eclipse.edt.mof.egl.ForStatement" isIncrement="true" >
				<annotations ID="181" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:80" off="i:1844" line="i:67" />
				<container IDREF="20"/>
				<body ID="182" eClass="org.eclipse.edt.mof.egl.StatementBlock" >
					<annotations ID="183" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:80" off="i:1844" line="i:67" />
					<container IDREF="20"/>
					<statements ID="184" eClass="org.eclipse.edt.mof.egl.AssignmentStatement" >
						<annotations ID="185" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:24" off="i:1883" line="i:68" />
						<container IDREF="20"/>
						<expr ID="186" eClass="org.eclipse.edt.mof.egl.Assignment" operator="=" >
							<annotations ID="187" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:23" off="i:1883" line="i:68" />
							<LHS ID="188" eClass="org.eclipse.edt.mof.egl.MemberName" id="total" >
								<annotations ID="189" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:5" off="i:1883" line="i:68" />
								<member IDREF="73"/>
							</LHS>
							<RHS ID="190" eClass="org.eclipse.edt.mof.egl.BinaryExpression" operator="+" >
								<annotations ID="191" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:15" off="i:1891" line="i:68" />
								<operands ID="192" eClass="org.eclipse.edt.mof.egl.MemberName" id="total" >
									<annotations ID="193" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:5" off="i:1891" line="i:68" />
									<member IDREF="73"/>
								</operands>
								<operands ID="194" eClass="org.eclipse.edt.mof.egl.MemberName" id="counter" >
									<annotations ID="195" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:7" off="i:1899" line="i:68" />
									<member IDREF="40"/>
								</operands>
							</RHS>
						</expr>
					</statements>
					<statements ID="196" eClass="org.eclipse.edt.mof.egl.ExitStatement" exitStatementType="0" >
						<annotations ID="197" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:5" off="i:1912" line="i:69" />
						<container IDREF="20"/>
					</statements>
				</body>
				<deltaExpression ID="198" eClass="org.eclipse.edt.mof.egl.IntegerLiteral" value="1" isNegated="false" >
					<annotations ID="199" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:1" off="i:1876" line="i:67" />
				</deltaExpression>
				<counterVariable ID="200" eClass="org.eclipse.edt.mof.egl.MemberName" id="counter" >
					<annotations ID="201" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:7" off="i:1850" line="i:67" />
					<member IDREF="40"/>
				</counterVariable>
				<fromExpression ID="202" eClass="org.eclipse.edt.mof.egl.IntegerLiteral" value="5" isNegated="false" >
					<annotations ID="203" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:1" off="i:1863" line="i:67" />
				</fromExpression>
				<toExpression ID="204" eClass="org.eclipse.edt.mof.egl.MemberName" id="stop" >
					<annotations ID="205" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:4" off="i:1868" line="i:67" />
					<member IDREF="55"/>
				</toExpression>
			</statements>
Comment 1 Paul Harmon CLA 2011-08-18 14:43:23 EDT
I do not understand why this testcase should NOT be increment. According to the code you have pasted, this should be an incremental for.
Comment 2 Lisa Lasher CLA 2011-11-02 10:29:11 EDT
closing this defect for Scott