aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-tasks.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-02-28 16:30:42 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-02-28 16:30:42 +0000
commitd4cd3da9f398080483b482e1aa5b07578697f438 (patch)
treeff306e0777860522f21b1eb8f2aabcd509497dc9 /gdb/ada-tasks.c
parent7964b62a371300465a2bc8295cc179b7831a1e24 (diff)
downloadgdb-d4cd3da9f398080483b482e1aa5b07578697f438.zip
gdb-d4cd3da9f398080483b482e1aa5b07578697f438.tar.gz
gdb-d4cd3da9f398080483b482e1aa5b07578697f438.tar.bz2
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 4c0b667..11ad262 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))
{