summaryrefslogtreecommitdiff
path: root/gdb/ada-tasks.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-02-28 16:30:30 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-02-28 16:30:30 +0000
commit6defe671d1a7e11e8a7e9b682a2c20e26fb8d4d0 (patch)
treeb49ed9eed5c1b5a2c0de19f15fee7d19cde8e61b /gdb/ada-tasks.c
parent45331a69bfe6e5100bc4f3b1d92001ff5b6b4e51 (diff)
downloadgdb-6defe671d1a7e11e8a7e9b682a2c20e26fb8d4d0.tar.gz
Fix ARI violation in ada_tasks_inferior_data_sniffer.
This patch removes some variable assignments inside condition expressions. gdb/ChangeLog: * ada-tasks.c (ada_tasks_inferior_data_sniffer): Rework code to avoid variable assignments inside condition.
Diffstat (limited to 'gdb/ada-tasks.c')
-rw-r--r--gdb/ada-tasks.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 4c0b66795c9..11ad2621e58 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -870,13 +870,15 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
{
/* Validate. */
struct type *type = check_typedef (SYMBOL_TYPE (sym));
- struct type *eltype;
- struct type *idxtype;
-
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
- && (eltype = check_typedef (TYPE_TARGET_TYPE (type)))
- && TYPE_CODE (eltype) == TYPE_CODE_PTR
- && (idxtype = check_typedef (TYPE_INDEX_TYPE (type)))
+ struct type *eltype = NULL;
+ struct type *idxtype = NULL;
+
+ if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ eltype = check_typedef (TYPE_TARGET_TYPE (type));
+ if (eltype != NULL
+ && TYPE_CODE (eltype) == TYPE_CODE_PTR)
+ idxtype = check_typedef (TYPE_INDEX_TYPE (type));
+ if (idxtype != NULL
&& !TYPE_LOW_BOUND_UNDEFINED (idxtype)
&& !TYPE_HIGH_BOUND_UNDEFINED (idxtype))
{