aboutsummaryrefslogtreecommitdiff
path: root/gdb/gnu-v3-abi.c
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-10-16 07:14:13 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-10-24 05:45:06 -0700
commit3433cfa51f6397231ffe2b2c69298eff89179769 (patch)
treea23794d36eba05860099cb464be0fb2f152792bb /gdb/gnu-v3-abi.c
parent68fcca92b735bb46e38331485ac2e933e5876b83 (diff)
downloadfsf-binutils-gdb-3433cfa51f6397231ffe2b2c69298eff89179769.zip
fsf-binutils-gdb-3433cfa51f6397231ffe2b2c69298eff89179769.tar.gz
fsf-binutils-gdb-3433cfa51f6397231ffe2b2c69298eff89179769.tar.bz2
Guard a call to TYPE_TARGET_TYPE in gnuv3_pass_by_reference.
gdb/ChangeLog: * gnu-v3-abi.c (gnuv3_pass_by_reference): Call TYPE_TARGET_TYPE on the arg type of a constructor only if it is of reference type. gdb/testsuite/ChangeLog: * gdb.cp/non-trivial-retval.cc: Add a test case. * gdb.cp/non-trivial-retval.exp: Add a test.
Diffstat (limited to 'gdb/gnu-v3-abi.c')
-rw-r--r--gdb/gnu-v3-abi.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index a6c6f9f..b960aa3 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1320,13 +1320,15 @@ gnuv3_pass_by_reference (struct type *type)
if (TYPE_NFIELDS (fieldtype) == 2)
{
struct type *arg_type = TYPE_FIELD_TYPE (fieldtype, 1);
- struct type *arg_target_type;
- arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+ if (TYPE_CODE (arg_type) == TYPE_CODE_REF)
+ {
+ struct type *arg_target_type;
- if (TYPE_CODE (arg_type) == TYPE_CODE_REF
- && class_types_same_p (arg_target_type, type))
- return 1;
+ arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+ if (class_types_same_p (arg_target_type, type))
+ return 1;
+ }
}
}