First Last Prev Next    No search results available
Details
: [llvm-g++] Do not use dynamic initialization where static...
Bug#: 509
: tools
: llvm-g++
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.4
: P2
: normal
: 1.5

:
: miscompilation
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <clattner@apple.com>
Assigned To: Chris Lattner <clattner@apple.com>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2005-02-13 19:18
For the following testcase:

---
struct Data {
  unsigned *data;
  unsigned array[1];
};

Data shared_null = { shared_null.array, {0} };
---

llvm-g++ emits a dynamic initialization of the 'shared_null' global.  g++
statically intializes the global (because the initializer *IS* a constant), and
we should too.

This bug causes us to miscompile QT-4.0, as it has other dynamic intializers
that depend on this.  In this case, some initializers run that use this, then
this initializer runs, then others run.  This is a problem.

-Chris
------- Comment #1 From Chris Lattner 2005-02-13 21:24:42 -------
Fixed.  Testcase here:
test/Regression/C++Frontend/2005-02-13-BadDynamicInit.cpp

Primary patch here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024086.html

Note that this patch is the correct fix for some old ugly gross hacky code that
worked around bugs in GCC.  As such, these patches are now in to revert the
ugliness:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024087.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024088.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024089.html

-Chris
------- Comment #2 From Chris Lattner 2005-02-14 15:27:06 -------
Note that these patches caused a regression in Prolangs-C/cdecl.  These patches
fix the regression:

http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050214/024105.html
...
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050214/024110.html

-Chris

First Last Prev Next    No search results available