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] PR38917 and PR38918 - DATA and pointers


I also want to thank Dick for his great bugreports which are clear,
nicely reduced and well-founded. I also want to thank him for the nice
book, which he coauthored: The Fortran 2003 Handbook.

Paul Richard Thomas wrote:
> We were not doing very well with DATA and pointers up until now.  This
> patch fixes that.  As it happens the fix is trivial/obvious.
>
> Bootstrapped and regtested on FC9/x86_64 - OK for.... trunk/4.5?
>   

[ICE on invalid] -- I think the check

+  if (e->rank == 0 || var->expr->symtree->n.sym->attr.pointer)

is too simple as the following is rank == 0 and the symbol as the
pointer value, but it is actually referring the pointer target for which
one may not use:

   data p(1) /null()/

==1092== Invalid read of size 4
==1092==    at 0x5CD2CCB: __gmpz_sub (in /usr/lib64/libgmp.so.3.4.3)
==1092==    by 0x417040: get_array_index (data.c:67)
==1092==    by 0x417BF0: gfc_assign_data_value (data.c:312)
==1092==    by 0x46E1E3: traverse_data_var (resolve.c:9580)
==1092==    by 0x471069: resolve_types (resolve.c:9762)


The following can be fixed later. The error message is valid (no mold=
is allowed) but it is also rather incomprehensible:

data p /null(p)/
            1
Error: Symbol 'null' must be a PARAMETER in DATA statement at (1)

Tobias

> 2009-01-22  Paul Thomas  <pault@gcc.gnu.org>
>
> 	PR fortran/38917
> 	* expr.c (gfc_check_assign): Allow pointer components when
> 	checking for NULL.
>
> 	PR fortran/38918
> 	* resolve.c (check_data_variable): Treat pointer arrays with
> 	scalars.
>
> 2009-01-22  Paul Thomas  <pault@gcc.gnu.org>
>
> 	PR fortran/38917
> 	PR fortran/38918
> 	* gfortran.dg/data_pointer_1.f90: New test.


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