GFC_TYPE_ARRAY_LBOUND and descriptors

Daniel Kraft d@domob.eu
Thu Aug 19 08:27:00 GMT 2010


Hi,

I've just stumbled upon something which I can not make sense of...  And 
hope someone will help me.  In trans, I work (for the pointer 
bounds/rank remapping patch) with array descriptors; to query their 
bounds, I use things like

   gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim])

which works fine.  Now I just discovered that there are functions like

   gfc_conv_array_lbound (desc, dim)

that are not only shorter to type (useful with 80 character lines :P) 
but also seem to me to be "the correct" ones to query an lbound. 
However, this function returns in my case 0 although the descriptor's 
lbound is 2, thus if I use those I get miscompiled code.

Now, looking at gfc_conv_array_lbound suggests that it first tries to 
use GFC_TYPE_ARRAY_LBOUND and uses gfc_conv_descriptor_lbound_get if 
this fails.  GDB shows me that GFC_TYPE_ARRAY_LBOUND does return 0 for a 
type-argument printed as "struct array1_integer(kind=4)".  Although this 
is more or less just a "gut feeling", I do not understand why this is 
the case and not a NULL_TREE is returned.  I would have thought that 
GFC_TYPE_ARRAY_LBOUND returns NULL for descriptors and just a bound if 
it is some kind of descriptor-less array.

So what's wrong with my thinking?  Any clarification is appreciated... 
Although I think I'm just going with the *conv_descriptor* functions 
which seem to do what I need.

Yours,
Daniel

-- 
http://www.pro-vegan.info/
--
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri



More information about the Fortran mailing list