| Summary: | [loop] Incorrect dead code reporting in simple loop | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Bram Kivenko <bram> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | srikanth_sankaran, stephan.herrmann |
| Version: | 3.8 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Ayush/Stephan - Is this due to lack of support for correlation analysis ? Greetings from Reston at the eve of EclipseCon :) (In reply to comment #1) > Ayush/Stephan - Is this due to lack of support for correlation analysis ? I'm pretty sure this is the same issue as bug 373032. Thanks Stephan, after it is fully confirmed, you can close this as duplicate. We have a few open bugs regarding flow analysis of loops, putting it into that bucket. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: 20120216-1857 Eclipse is reporting line 10 is dead code, while it is not. Dead code reporting is probably broken on the boolean branch analysis. When the "if" statement is broken into if-else-if statements, the dead code warning goes away. This code executes correctly, but line 10 is reported as dead code: 01: String s = null; 02: String s2 = null; 03: for ( int i = 0; i < 3; i++ ) { 04: if ( s == null || i >= 0 ) { 05: s2 = s; 06: s = "A"; 07: } 08: } 09: if ( s2 != null ) { 10: System.out.println("HI"); 11: } Interestingly, this IS evaluated correctly: 01: String s = null; 02: String s2 = null; 03: for ( int i = 0; s2 == null; i++ ) { 04: if ( s == null || i >= 0 ) { 05: s2 = s; 06: s = "A"; 07: } 08: } 09: if ( s2 != null ) { 10: System.out.println("HI"); 11: } Because of the difficulty in confirming the dead code warning is invalid, it ultimately can contribute to coding errors. Reproducible: Always