Hi,
Following is the fix to bug #594. The symptom is segmentation fault in
g++ front-end
during the generic to spin conversion. Following is the the c++ snippet that
trigger the problem.
#pragama weak bar1=foo1
extern "C" void foo1(void) {}
The root cause is that the decl.lang_specific field of the decl tree of
bar1 is NULL.
Thanks
Shuxin
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (revision 3413)
+++ gcc/tree.c (working copy)
@@ -10519,7 +10519,19 @@
if (TREE_PUBLIC (t))
_gs_bv (cp_decl_flags, GS_DECL_ONE_ONLY, DECL_ONE_ONLY (t));
- if (CPR()) { /* C++ */
+ /* Following C++ snippet necessitates the need of condition
+ * "DECL_LANG_SPECIFIC(t) != NULL".
+ *
+ * #pragma weak bar1 = foo1
+ * extern "C" void foo1 (void) { }
+ *
+ * The front end creates a decl tree both for bar1() and foo1().
+ * The decl.lang_specific field of the decl tree for bar1() is
NULL,
+ * as evidenced in maybe_apply_pending_pragma_weaks().
+ * If the <t> being procesed is the decl tree for bar1(), calling
+ * macros like DECL_GLOBAL_CTOR_P will incur segamentation fault.
+ */
+ if (CPR() && DECL_LANG_SPECIFIC(t)) { /* C++ */
switch (TREE_CODE(t)) {
case FUNCTION_DECL:
_gs_bv(cp_decl_flags, GS_DECL_GLOBAL_CTOR_P,
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel