------- Additional Comments From dannysmith at users dot sourceforge dot net
2005-06-13 22:05 -------
The patch is still not correct. It doesn't handle dllimport override semantics.
See g++.dg/ext/dllimport-3.C which fails because TREE_INVARIANT and
TREE_CONSTANT change when we lose the dllimport attribute. That can
be "fixed" by modifying recompute_tree_invariant_for_addr_expr to special-case
dllimports, but this is getting a bit hackish to me. In many ways dllimports
are like DECL_THREAD_LOCAL. However, thread-local attribute can't get
overridden, while dllimport attribute can.
Also this part of the revised patch is wrong.
It should be targetm.decl_non_addr_const_p
--- gcc/varasm.c 8 Jun 2005 00:15:53 -0000 1.513
+++ gcc/varasm.c 12 Jun 2005 04:32:36 -0000
@@ -3608,7 +3608,7 @@
if (value
&& TREE_CODE (value) == FUNCTION_DECL
&& ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value))
- || DECL_NON_ADDR_CONST_P (value)))
+ || TARGET_DECL_NON_ADDR_CONST_P (value)))
return NULL_TREE;
return value;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21766