[ARM] Fix endless recursion on calculating CPRC candidate
authorYao Qi <yao.qi@linaro.org>
Tue, 5 Jul 2016 14:29:20 +0000 (15:29 +0100)
committerYao Qi <yao.qi@linaro.org>
Wed, 6 Jul 2016 07:24:35 +0000 (08:24 +0100)
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.

gdb/ChangeLog
gdb/arm-tdep.c

index 7cec5ad8c23454eb827d0833321f2e7907641ada..a2fe153f8b09ebdbe350e72666b7ed9cdecef3fe 100644 (file)
@@ -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
index 278f639fe8d8d1ee3e15eeb7c2affb2d433bf190..d2661cb61cb60310e527bf61596986155b86a023 100644 (file)
@@ -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;