[LLVMbugs] [Bug 115] llvm-gcc fails to infer a constant expr involving static ptr is also constant
bugzilla-daemon at zion.cs.uiuc.edu
bugzilla-daemon at zion.cs.uiuc.edu
Sun Nov 16 12:49:31 PST 2003
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=115
sabre at nondot.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From sabre at nondot.org 2003-11-16 14:49 -------
This bug was caused by the fix to Bug 84, so it was not present in 1.0.
The test is: test/Regression/CFrontend/2003-11-16-StaticArrayInit.c
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031110/009563.html
Fixed like this:
$ diff -u c-common.c~ c-common.c
--- c-common.c~ Thu Nov 13 01:08:20 2003
+++ c-common.c Sun Nov 16 14:45:22 2003
@@ -2528,7 +2528,8 @@
intop = convert (c_common_type_for_size (TYPE_PRECISION (sizetype),
TREE_UNSIGNED (sizetype)), intop);
- if (EMIT_LLVM) {
+ /* Don't create an ARRAY_REF if this is a potentially a static initializer. */
+ if (EMIT_LLVM && (!TREE_CONSTANT (ptrop) || !TREE_CONSTANT(intop))) {
/* In LLVM we really want to represent this as &P[i], not as P+i*sizeof(*P)
*/
tree arrayref;
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list