From: Joel Brobecker <brobecker@adacore.com>
To: Chandru <chandru@in.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: gdb can't print array element for fortran
Date: Mon, 15 Mar 2010 17:13:00 -0000 [thread overview]
Message-ID: <20100315171325.GN3045@adacore.com> (raw)
In-Reply-To: <201003121836.24712.chandru@in.ibm.com>
> This mail pertains to the discussion had on gdb mailing list sometime
> back here http://sourceware.org/ml/gdb-patches/2009-01/msg00251.html.
> After a small discussion with Jan I made the following changes and
> these didn't seem to work. Any inputs or thoughts would be helpful.
Does anyone else have an opinion on this patch. It looks wrong to me
(sorry Chandru): Arrays with a high bound that's less than the low bound
can exist, at least in Ada. It's just an empty array.
I haven't looked at Jan's work for the Fortran VLA stuff in a while,
so I can't remember how he dealt with this issue. But I think his
approach might be more correct.
> --- src/gdb/gdbtypes.c.orig 2010-02-25 00:00:19.000000000 +0530
> +++ src/gdb/gdbtypes.c 2010-02-25 00:03:16.000000000 +0530
> @@ -727,6 +727,14 @@ create_range_type (struct type *result_t
> if (low_bound >= 0)
> TYPE_UNSIGNED (result_type) = 1;
>
> + if (high_bound < low_bound)
> + {
> + if (high_bound == -1)
> + TYPE_HIGH_BOUND_UNDEFINED(result_type) = 1;
> + else
> + TYPE_HIGH_BOUND_UNDEFINED(result_type) = 0;
> + }
> +
> return result_type;
> }
>
> --- src/gdb/valarith.c.orig 2010-02-25 00:00:26.000000000 +0530
> +++ src/gdb/valarith.c 2010-02-25 00:04:37.000000000 +0530
> @@ -198,7 +198,7 @@ value_subscripted_rvalue (struct value *
> unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
> struct value *v;
>
> - if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
> + if (index < lowerbound || ((elt_offs >= TYPE_LENGTH (array_type)) && !TYPE_HIGH_BOUND_UNDEFINED(array_type)))
> error (_("no such vector element"));
>
> v = allocate_value (elt_type);
--
Joel
next prev parent reply other threads:[~2010-03-15 17:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 13:06 Chandru
2010-03-15 17:13 ` Joel Brobecker [this message]
2010-03-15 20:52 ` Tom Tromey
2010-03-15 23:46 ` Jan Kratochvil
2010-03-16 15:16 ` Joel Brobecker
2010-03-16 21:04 ` Jan Kratochvil
2010-03-18 11:24 Nick Roberts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100315171325.GN3045@adacore.com \
--to=brobecker@adacore.com \
--cc=chandru@in.ibm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox