On Jan 12, 2006, at 7:53 AM, Aleksandar Donev wrote: > Bertrand Meltz wrote: > >> In the example below, is typ%in a whole array, in which case its >> bounds should be (0,4), or an array section, in which case its bounds >> should be (1,5). > It is an array section. I always have to look this stuff up, because otherwise I get the fine points of distinction wrong. I agree that this is a section, by Aleksander's derivation, but... the original question has a misconception in implying that "whole array" or section are the only two possibilities. If you look at the definition of LBOUND, you won't find the word "section". Instead, you will find "If ARRAY is a whole array or array structure component..". So let's look at that question instead of the question of whether ARRAY is a section, which doesn't seem to have much to do with the definition of LBOUND. Looks to me like, although typ%in is a section (per Aleksander's derivation), it is also a structure component. Odd, I thought those were mutually exclusive, but it sure doesn't look like it to me. The definition of structure component (R614) is pretty simple. It is just a data-ref (all these kinds of things are that) with the constraint that there shall be more than one part-ref (typ%in has 2) and that the rightmost part-ref shall be of the form part-name (which "in" is). In fact, the standard has a similar example in Note 6.5, where it gives array_parent(1:n)%scalar_field as an example of a structure component. Thus, the bounds should be (0,4). > The only time something with % in it is not an array section is when > the > last piece is a whole array: Other matters aside, a "whole array" is never a "piece" of any other syntax. As noted above, a whole array is defined to be a named array. That means just a plain, unadorned name. That does not mean a component name because a component name alone does not identify array. You can't just talk about the array "in" without qualifying that you mean typ%in. >> Some compilers even >> interpret typ%in and pt_1 differently, which adds to my confusion. That's pretty definite. Even if Aleksander and/or myself are messed up somewhere on the section/component/whole-array question, the bounds resulting from pointer assignment are defined in terms of lbound. So whatever lbound gives for typ%in had better be the lower bound that pt_1 gets (and thus that lbound returns for it). -- Richard Maine | Good judgment comes from experience; [log in to unmask] | experience comes from bad judgment. | -- Mark Twain