This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR35810 - [TR 15581 / F2003] Automatic reallocation on assignment to allocatable variables


Dear Paul,

Paul Richard Thomas wrote:
Not only does the patch bootstrap and regtest but it runs Polyhedron
correctly this time!  OK for trunk?

Reading the code I think you mishandle kind=4 characters as you seem to allocate only (char-length) bytes instead of (storage size of an element)*(char length). However, when I tries it, I already get a segfault with kind=1 characters:


character(kind=1, len=100), allocatable, dimension(:) :: str
str = [ "abc" ]
end

Ditto for character kind=4.


Additionally, you have lots of checks of the form: + if (!expr1->symtree->n.sym->attr.allocatable + || (expr1->ref && expr1->ref->type == REF_ARRAY

Those fail if you work with derived types such as:

type t
  integer, allocatable :: a(:)
end type t
type(t) :: x

x%a= [1,2,3]
print *, x%a
x%a = [1]
print * ,x%a
end

As "x" is not allocatable, only "x%a" is. For the attribute, you should could use gfc_expr_attr (), for the last component ref, you need to use a manual for loop, unless I missed a helper function.

Otherwise, the patch looks good.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]