diff mbox

[ARM] Fix PR45447

Message ID 4CA47A4A.5050404@codesourcery.com
State New
Headers show

Commit Message

Yao Qi Sept. 30, 2010, 11:53 a.m. UTC
Richard Guenther wrote:
> On Thu, Sep 30, 2010 at 1:30 PM, Yao Qi <yao@codesourcery.com> wrote:
>> Richard Guenther wrote:
>>> On Thu, Sep 30, 2010 at 1:10 PM, Yao Qi <yao@codesourcery.com> wrote:
>>>> We created a struct type for va_list to follow ARM ABI, but TREE_CHAIN
>>>> (va_list_type) is *not* set properly.  This problem causes segmentation
>>>> fault reported in PR45447.
>>>>
>>>> This patch is to address this problem.  Regression test for
>>>> arm-none-linux-gnueabi is still running.  OK to trunk/4.5/4.4 if no
>>>> regression?
>>> Err - why do you think assigning to TREE_CHAIN makes sense?
>> Because 1) TYPE_STUB_DECL and TREE_CHAIN is the same thing, defined in
>> tree.h,
>>
>>  #define TYPE_STUB_DECL(NODE) TREE_CHAIN (NODE)
>>
>> 2) TREE_CHAIN is used also for the similar purpose in i386.c:
>> ix86_build_builtin_va_list_abi()
>>  TREE_CHAIN (record) = type_decl;
>>
>>> I think you want to use TYPE_STUB_DECL instead.
>>>
>> Are they different? or I may miss something.
> 
> TREE_CHAIN is non-descriptive, it shouldn't be used if there is
> a more descriptive macro available.

OK, thanks for your explanation.  Here is a new patch.

Comments

Mark Mitchell Oct. 13, 2010, 8:06 p.m. UTC | #1
On 9/30/2010 4:53 AM, Yao Qi wrote:

> OK, thanks for your explanation.  Here is a new patch.

> gcc/
> 2010-09-30  Yao Qi  <yao@codesourcery.com>
> 
> 	PR target/45447	
> 	* config/arm/arm.c (arm_build_builtin_va_list): Assign
> 	va_list_name to TYPE_STUB_DECL (va_list_type). 

OK.
diff mbox

Patch

gcc/
2010-09-30  Yao Qi  <yao@codesourcery.com>

	PR target/45447	
	* config/arm/arm.c (arm_build_builtin_va_list): Assign
	va_list_name to TYPE_STUB_DECL (va_list_type). 

gcc/testsuite/
2010-09-30  Yao Qi  <yao@codesourcery.com>

	PR target/45447
	* gcc.target/arm/pr45447.c: New test.


diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 2ff010b..a5921fd 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -1205,6 +1205,7 @@  arm_build_builtin_va_list (void)
 			     va_list_type);
   DECL_ARTIFICIAL (va_list_name) = 1;
   TYPE_NAME (va_list_type) = va_list_name;
+  TYPE_STUB_DECL (va_list_type) = va_list_name;
   /* Create the __ap field.  */
   ap_field = build_decl (BUILTINS_LOCATION,
 			 FIELD_DECL, 
diff --git a/gcc/testsuite/gcc.target/arm/pr45447.c b/gcc/testsuite/gcc.target/arm/pr45447.c
new file mode 100644
index 0000000..cb4a442
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr45447.c
@@ -0,0 +1,3 @@ 
+/* { dg-do compile } */
+/* { dg-options "-g -femit-struct-debug-baseonly" } */
+typedef __builtin_va_list x;