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 9 - LLVM needs explicit support for weak variables
Summary: LLVM needs explicit support for weak variables
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-gcc (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2003-10-07 15:42 PDT by Chris Lattner
Modified: 2010-02-22 12:50 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2003-10-07 15:42:57 PDT
Compile this program with the C frontend:

-----
int X;
-----

X is removed from the translation unit.  In C, the variable must be declared as
weak, and since LLVM has no notion of the difference between "linkonce" and
"weak", the optimizer things the variable is safe to delete.
Comment 1 Chris Lattner 2003-10-09 23:54:53 PDT
This is tested by: GlobalDCE/2003-10-09-PreserveWeakGlobals.ll
Comment 2 Chris Lattner 2003-10-10 00:30:30 PDT
This has been fixed in the C Frontend.  This just needs to be fixed in LLVM proper.
Comment 3 Chris Lattner 2003-10-16 13:29:45 PDT
Weak linkage is now implemented