From: Yao Qi <qiyaoltc@gmail.com>
To: "Heckel\, Bernhard" <bernhard.heckel@intel.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,
brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] fort_dyn_array: Enable dynamic member types inside a structure.
Date: Tue, 05 Apr 2016 10:47:00 -0000 [thread overview]
Message-ID: <86inzwnxik.fsf@gmail.com> (raw)
In-Reply-To: <570369BC.60407@intel.com> (Bernhard Heckel's message of "Tue, 5 Apr 2016 09:31:08 +0200")
"Heckel, Bernhard" <bernhard.heckel@intel.com> writes:
> Actually, when resolving dynamic types I don't use the valaddr. From
> what I understood
> I could even return if valaddr is not Null as the TYPE should already
> be resolved at that time.
> But I was unsure about it and kept the code.
OK, that is a separate issue.
>>
>>> pinfo.next = addr_stack;
>>> TYPE_FIELD_TYPE (resolved_type, i)
>>> @@ -2090,8 +2091,13 @@ resolve_dynamic_struct (struct type *type,
>>> resolved_type_bit_length = new_bit_length;
>>> }
>>> - TYPE_LENGTH (resolved_type)
>>> - = (resolved_type_bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
>>> + /* Type length won't change for fortran. Keep what we got from DWARF.
>> Two spaces after ".". Multiple instances of this problem.
>>
>>> + Dynamic fields might change over time but not the struct definition.
>>> + If we would adapt it we run into problems when
>>> + calculating the element offset for arrays of structs. */
>> What is the problem we run into?
> Imagine we have a dynamic allocatable array as a member of a
> structure. The size of the dynamic array can vary over time.
> When we have resolved this allocatable array we don't want to add it's
> length to the structure length it belongs to.
> Dynamic members are not embedded in the structure itself. Only the
> description of the dynamic type is embedded
> and the size of the description (address, bounds,...) won't change.
That is a FORTRAN specific feature. The structure's size changes when the
dynamic array's size changes in C. I am not 100% sure about Ada, but I
suspect it is the same as C in this aspect after I read
https://sourceware.org/ml/gdb-patches/2014-05/msg00522.html
Could you rewrite the comments to say the length of type won't change
for FORTRAN, but the length changes for C (and Ada?).
>>> -\f
>>> /* Access to the value history. */
>>> /* Record a new value in the value history.
>>> @@ -2416,6 +2428,12 @@ set_internalvar (struct internalvar *var, struct value *val)
>>> call error () until new_data is installed into the var->u to avoid
>>> leaking memory. */
>>> release_value (new_data.value);
>>> +
>>> + /* Internal variables which are created from values with a dynamic location
>>> + don't need the location property of the origin anymore.
>>> + Remove the location property in case it exist. */
>>> + remove_dyn_prop(DYN_PROP_DATA_LOCATION, value_type(new_data.value));
>> Space is needed before "(". What is wrong if we don't do so? Do you
>> have a test case for this?
> An internal variable has it's own valaddr to where the copy is located.
> If we keep the dynamic location from the origin then this
> dyn. location will be used to set
> the value component location.
> As the internal variable is a copy of an value at a certain point in
> time I prefer to get rid off the
> dynamic location attribute then to do some "if else if else"
> constructs when setting the component location.
We remove the dynamic properties from type A for internal variable, but
there is another variable is still using type A. These dynamic
properties can't be found any more. Is it a problem?
> There are tests:
> gdb.fortran/vla-value.exp: print $myvar set to vla1
> gdb.fortran/vla-value.exp: print $myvar(3,6,9)
but they are PASS in mainline.
--
Yao (齐尧)
next prev parent reply other threads:[~2016-04-05 10:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 8:43 [PATCH 0/3] fortran: Enable arrays of structures with dynamic member types Bernhard Heckel
2016-03-17 8:43 ` [PATCH 3/3] fort_dyn_array: Use value constructor instead of raw-buffer manipulation Bernhard Heckel
2016-04-04 13:54 ` Yao Qi
2016-04-05 9:31 ` Heckel, Bernhard
2016-03-17 8:43 ` [PATCH 1/3] fort_dyn_array: Enable dynamic member types inside a structure Bernhard Heckel
2016-04-04 9:22 ` [PATCH 1/3][PING] " Heckel, Bernhard
2016-04-04 13:31 ` [PATCH 1/3] " Yao Qi
2016-04-04 16:24 ` Yao Qi
2016-04-05 7:31 ` Heckel, Bernhard
2016-04-05 10:47 ` Yao Qi [this message]
2016-04-05 12:42 ` Heckel, Bernhard
2016-04-06 16:09 ` Yao Qi
2016-04-07 6:03 ` Heckel, Bernhard
2016-03-17 8:43 ` [PATCH 2/3] fort_dyn_array: Support evaluation of dynamic elements inside arrays Bernhard Heckel
2016-04-04 9:22 ` [PATCH 2/3][PING] " Heckel, Bernhard
2016-04-04 13:42 ` [PATCH 2/3] " Yao Qi
2016-04-04 9:21 ` [PATCH 0/3][PING] fortran: Enable arrays of structures with dynamic member types Heckel, Bernhard
2016-04-04 10:50 ` [PATCH 0/3] " Yao Qi
2016-04-04 12:16 ` Heckel, Bernhard
2016-04-04 14:41 ` Yao Qi
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=86inzwnxik.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=bernhard.heckel@intel.com \
--cc=brobecker@adacore.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