Hi,
Could you use the conditional to guard code at a smaller granularity, i.e.,
maybe guard only the code under the FUNCTION_DECL case statement (ideally
enclose the smallest chunk of code depending on this)? The reason is there is
some other code under the CPR() conditional that needs DECL_LANG_SPECIFIC, and
they are already guarded as such. There is some code under CPR() which is valid
even if DECL_LANG_SPECIFIC is NULL. So we probably don't want to disable these
codes just because this field is null, unless we can prove it's safe to do so.
Thanks,
Gautam
________________________________
From: shuxin yang <[email protected]>
To: [email protected]
Sent: Thu, December 2, 2010 2:13:26 PM
Subject: [Open64-devel] request code review
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel