OSDN Git Service

(pos_atr): Account for the possibility that the argument may be a reference.
authorhilfingr <hilfingr>
Sat, 16 Aug 2008 09:26:24 +0000 (09:26 +0000)
committerhilfingr <hilfingr>
Sat, 16 Aug 2008 09:26:24 +0000 (09:26 +0000)
gdb/ChangeLog
gdb/ada-lang.c

index a703727..9a90d50 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-16  Paul N. Hilfinger  <hilfinger@adacore.com>
+
+       * ada-lang.c (pos_atr): Account for the possibility that the 
+       argument may be a reference.
+
 2008-08-16  Paul N. Hilfinger  <hilfingr@adacore.com>
 
        * xcoffread.c (scan_xcoff_symtab): Do not include global symbols
index f3f1f34..63f1a41 100644 (file)
@@ -7634,7 +7634,8 @@ ada_attribute_name (enum exp_opcode n)
 static LONGEST
 pos_atr (struct value *arg)
 {
-  struct type *type = value_type (arg);
+  struct value *val = coerce_ref (arg);
+  struct type *type = value_type (val);
 
   if (!discrete_type_p (type))
     error (_("'POS only defined on discrete types"));
@@ -7642,7 +7643,7 @@ pos_atr (struct value *arg)
   if (TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
       int i;
-      LONGEST v = value_as_long (arg);
+      LONGEST v = value_as_long (val);
 
       for (i = 0; i < TYPE_NFIELDS (type); i += 1)
         {
@@ -7652,7 +7653,7 @@ pos_atr (struct value *arg)
       error (_("enumeration value is invalid: can't find 'POS"));
     }
   else
-    return value_as_long (arg);
+    return value_as_long (val);
 }
 
 static struct value *