[Patch, fortran] PR38917 and PR38918 - DATA and pointers
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sat Jan 24 10:04:00 GMT 2009
Dear Tobias,
Here is another try... it no longer seg-faults on the invalid, at least:-)
Paul
On Thu, Jan 22, 2009 at 10:17 PM, Tobias Burnus <burnus@net-b.de> wrote:
>
> 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.
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: application/octet-stream
Size: 3427 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090124/2d342298/attachment.obj>
More information about the Fortran
mailing list