LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2763 - CFG: 'continue' statements jump to loop condition instead of increment code
Summary: CFG: 'continue' statements jump to loop condition instead of increment code
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Static Analyzer (show other bugs)
Version: unspecified
Hardware: Macintosh MacOS X
: P normal
Assignee: Ted Kremenek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-04 14:12 PDT by Tom Bunch
Modified: 2018-11-07 00:22 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
Contains a single short instance method that produces a false dead store (1019 bytes, text/plain)
2008-09-04 14:12 PDT, Tom Bunch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Bunch 2008-09-04 14:12:48 PDT
Created attachment 1987 [details]
Contains a single short instance method that produces a false dead store

The static analyzer finds dead stores, which it thinks are dead due to a later assignment that can't be reached because the first assignment is always followed by a branch that misses the second.  I expect this is a more general problem untangling code paths, but this is a good illustration.  

checker-85 (2008-08-28 14:46:11)
Mac OS X 10.5.4

Attached is a small objc method that reproduces a false dead store positive.  It's derived from a larger example and probably doesn't make a great deal of sense from a semantic point of view.  The gist is that the loop counter "index" is incremented by one or more on each iteration.

I can make this a standalone example if you'd prefer, or you can just drop this code into any Foundation based class implementation you have lying about.
Comment 1 Ted Kremenek 2008-09-04 16:54:15 PDT
This was a low-level CFG bug.  It's quite startling it wasn't discovered earlier.

Fixed:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080901/007420.html

Will roll into checker-89 (building right now).
Comment 2 Ted Kremenek 2008-09-04 20:21:42 PDT
Integrated into checker-89.
Comment 3 Ted Kremenek 2008-09-04 20:22:51 PDT
Tom: Can you verify that this change removes these idiomatic false positives from your code?
Comment 4 Tom Bunch 2008-09-09 17:02:25 PDT
Ted asked me to "verify that this change removes these idiomatic false positives", which it in fact it does (hooray!) so I'm setting the status to "Verify".  Hope that's the correct step for me.
Comment 5 Ted Kremenek 2008-09-11 12:07:20 PDT
Thanks Tom!