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 2573 - Dead initialization is reported even when 'unused' attribute is used
Summary: Dead initialization is reported even when 'unused' attribute is used
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-07-21 08:32 PDT by Nikita Zhuk
Modified: 2018-11-07 00:22 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
Test case: Dead initialization of a variable with 'unused' attribute (1.46 KB, text/plain)
2008-07-21 08:32 PDT, Nikita Zhuk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Zhuk 2008-07-21 08:32:45 PDT
Created attachment 1858 [details]
Test case: Dead initialization of a variable with 'unused' attribute

Clang static analyzer complains dead initialization of variables even if they're marked as 'unused', for example the following line produces dead initialization report:

NSString __attribute__((unused)) *str = [NSString stringWithString:@"some string"];

Test case is attached.

Clang rev: 53850
Comment 1 Ted Kremenek 2008-07-25 00:22:31 PDT
Fixed in checker-69.

Nikita: If it is no trouble, can you verify that this works for you?
Comment 2 Nikita Zhuk 2008-07-25 02:55:55 PDT
(In reply to comment #1)
> Fixed in checker-69.
> 
> Nikita: If it is no trouble, can you verify that this works for you?
> 

My test is green (well, it's a dot actually :). So yes, it works.