[LLVMbugs] [Bug 11208] New: ARC is too controlling and results in non-existence bugs.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Oct 22 07:31:11 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=11208
Summary: ARC is too controlling and results in non-existence
bugs.
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: multiHYP at gmail.com
CC: llvmbugs at cs.uiuc.edu
Summary:
I had a command line tools mae (Mono Alphabetic Encryption) that heavily used
NSCountedSets. Since I moved to Xcode 4.2 and had the code inside @autorelease
{...} blocks, there was a mysterious EXC_BAD_ACCESS or segmentation fault
appearing out of nowhere.
Long story short, it related to the line 161 available here:
https://github.com/multiHYP/mae/blob/fc19e2ea7c9c44b5f3728bb4f9a268379ca52e7b/mae/main.m#L161
Now, the problem arises when that while-loop only sometimes continues executing
for items in NSCountedSet, whose count was 1. Naturally after 1 iteration the
while-loop should quit, but if ARC is turned on, it doesn't. Again, for items
in an NSCountedSet whose count is 1, only sometimes that while-loop keeps
iterating.
Thanks.
Steps to Reproduce:
Go to that Github project and download a zipball of it. See the commit I linked
to above, because my project's latest release keeps changing. Important is to
make sure that your main.m is the same as the version I linked above. Enable
ARC as it is on by default, LLDB for your debugger and add the following two
arguments under your scheme: -rn and -utf8
Get that pg4300.txt file from project gutenberg, or some rather large text
file. I attach the file below. Make sure your path (input variable) in main.m
reflects the correct path respectively.
Run it.
Expected Results:
Every character in the text (-utf8 format) with its number of occurences should
appear in a reverse numerical/occurences (-rn) table. Notice, that some items
at the end/bottom of the table have the count 1, but suddenly the running hangs
and points you to the while-loop's line. There is only other characters with
occurrences of 1 left to print out, but despite having printed out some of
them, the others are failing.
Actual Results:
It should have in reality printed out a full table statistics of all those
characters and occurrences appearing in the text file, but it didn't.
Regression:
Notes:
Now, if you go to project settings and disable ARC, it works just fine and you
see the Actual Results.
I talked about it in #macdev irc channel and it seems that ARC is too
controlling in its nature and that results in such failure.
Thanks.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list