This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [ARM] Fix endless recursion on calculating CPRC candidate


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1040b979bc46474530fa4fee397b8acc460c01e9

commit 1040b979bc46474530fa4fee397b8acc460c01e9
Author: Yao Qi <yao.qi@linaro.org>
Date:   Tue Jul 5 15:29:20 2016 +0100

    [ARM] Fix endless recursion on calculating CPRC candidate
    
    When GDB determines whether type T can be part of candidate for
    passing and returning in VFP registers, it calls
    arm_vfp_cprc_sub_candidate recursively.  However, if type T has
    self-reference field, like,
    
    class C
    {
      static C s;
    };
    
    arm_vfp_cprc_sub_candidate won't return.  This fix is to skip calling
    arm_vfp_cprc_sub_candidate if the field is static.
    
    gdb:
    
    2016-07-06  Yao Qi  <yao.qi@linaro.org>
    
    	* arm-tdep.c (arm_vfp_cprc_sub_candidate): Don't call
    	arm_vfp_cprc_sub_candidate for static field.

Diff:
---
 gdb/ChangeLog  | 5 +++++
 gdb/arm-tdep.c | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7cec5ad..a2fe153 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-06  Yao Qi  <yao.qi@linaro.org>
+
+	* arm-tdep.c (arm_vfp_cprc_sub_candidate): Don't call
+	arm_vfp_cprc_sub_candidate for static field.
+
 2016-07-06  Manish Goregaokar  <manish@mozilla.com>
 
 	* rust-lang.c (rust_subscript): Allow subscripting pointers
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 278f639..d2661cb 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3554,8 +3554,11 @@ arm_vfp_cprc_sub_candidate (struct type *t,
 	int i;
 	for (i = 0; i < TYPE_NFIELDS (t); i++)
 	  {
-	    int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
-							base_type);
+	    int sub_count = 0;
+
+	    if (!field_is_static (&TYPE_FIELD (t, i)))
+	      sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
+						      base_type);
 	    if (sub_count == -1)
 	      return -1;
 	    count += sub_count;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]