aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-03-03 22:15:23 +0000
committerJeff Law <law@redhat.com>1995-03-03 22:15:23 +0000
commit13ffa6becef1f14ef849255b3ad5fadd2cbbb734 (patch)
treec5515f9a913ca75155afd3aacd99f351ad45aed1 /gdb
parent30e12576376285225b46ae673d41ecb468eadd1d (diff)
downloadfsf-binutils-gdb-13ffa6becef1f14ef849255b3ad5fadd2cbbb734.zip
fsf-binutils-gdb-13ffa6becef1f14ef849255b3ad5fadd2cbbb734.tar.gz
fsf-binutils-gdb-13ffa6becef1f14ef849255b3ad5fadd2cbbb734.tar.bz2
* valops.c (value_struct_elt_for_reference): Work around macro
bugs in HP's compilers. * c-exp.y (block): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/c-exp.y3
-rw-r--r--gdb/valops.c29
3 files changed, 32 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 398a985..f7ec8a6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+Fri Mar 3 15:12:12 1995 Jeff Law (law@snake.cs.utah.edu)
+
+ * valops.c (value_struct_elt_for_reference): Work around macro
+ bugs in HP's compilers.
+ * c-exp.y (block): Likewise.
+
Fri Mar 3 12:27:28 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
* rs6000-tdep.c (push_dummy_frame): Fix order of arguments to
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 77816af..f31dc07 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -548,8 +548,7 @@ block : BLOCKNAME
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
- $$ = BLOCKVECTOR_BLOCK
- (BLOCKVECTOR (tem), STATIC_BLOCK);
+ $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
diff --git a/gdb/valops.c b/gdb/valops.c
index a08dfc5..d2702a8 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -139,7 +139,29 @@ value_cast (type, arg2)
if (code1 == TYPE_CODE_BOOL)
code1 = TYPE_CODE_INT;
if (code2 == TYPE_CODE_BOOL)
- code2 = TYPE_CODE_INT;
+ code2 = TYPE_CODE_INT;
+
+ /* A cast to an undetermined-length array_type, such as (TYPE [])OBJECT,
+ is treated like a cast to (TYPE [N])OBJECT,
+ where N is sizeof(OBJECT)/sizeof(TYPE). */
+ if (code1 == TYPE_CODE_ARRAY
+ && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+ && TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
+ {
+ struct type *element_type = TYPE_TARGET_TYPE (type);
+ struct type *range_type = TYPE_INDEX_TYPE (type);
+ int low_bound = TYPE_LOW_BOUND (range_type);
+ int val_length = TYPE_LENGTH (VALUE_TYPE (arg2));
+ int new_length = val_length / TYPE_LENGTH (element_type);
+ if (val_length % TYPE_LENGTH (element_type) != 0)
+ warning("array element type size does not divide object size in cast");
+ range_type = create_range_type ((struct type *) NULL,
+ TYPE_TARGET_TYPE (range_type),
+ low_bound, new_length + low_bound - 1);
+ VALUE_TYPE (arg2) = create_array_type ((struct type *) NULL,
+ element_type, range_type);
+ return arg2;
+ }
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_FLT
|| code2 == TYPE_CODE_ENUM || code2 == TYPE_CODE_RANGE);
@@ -815,7 +837,7 @@ value_arg_coerce (arg, param_type)
switch (TYPE_CODE (type))
{
case TYPE_CODE_REF:
- if (TYPE_CODE (SYMBOL_TYPE (arg)) != TYPE_CODE_REF)
+ if (TYPE_CODE (VALUE_TYPE (arg)) != TYPE_CODE_REF)
{
arg = value_addr (arg);
VALUE_TYPE (arg) = param_type;
@@ -1911,8 +1933,7 @@ value_struct_elt_for_reference (domain, offset, curtype, name, intype)
(lookup_reference_type
(lookup_member_type (TYPE_FN_FIELD_TYPE (f, j),
domain)),
- (LONGEST) METHOD_PTR_FROM_VOFFSET
- (TYPE_FN_FIELD_VOFFSET (f, j)));
+ (LONGEST) METHOD_PTR_FROM_VOFFSET (TYPE_FN_FIELD_VOFFSET (f, j)));
}
else
{