This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] Fix for PR fortran/21375
On Sat, Jun 11, 2005 at 03:03:41PM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > OK for mainline? Ok for 4.0.1 with Mark's approval?
>
> This is ok with one minor nit:
>
> > + else
> > + {
> > + pstat = apstat = integer_zero_node;
> ^^^^^^^^^^^^^^^^^
>
> Those should be pointers to int4. See the top of
> gfc_build_io_library_fndecls() for how to create that type. We should
> probably add a global variable gfc_pint4_type_node for this along the other
> type nodes, and move that code out of gfc_build_io_library_fndecls, but I'm
> fine if you put it in a local variable.
>
Sigh. I wish either you or Paul B would take the time to
explain how one works within the poorly commented/documented
trans-*.[ch] files when these minor little nits arise. While
self-education is a wonderful thing, for many of us spare time
to work on gfortran is very limited.
Fine I changed gfc_build_builtin_function_decls() to include
tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
gfor_fndecl_deallocate =
gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
void_type_node, 2, ppvoid_type_node,
gfc_pint4_type_node);
Seems to work ok.
I then change gfc_trans_deallocate() to include
tree gfc_int4_type_node = gfc_get_int_type (4);
else
{
pstat = apstat = build_pointer_type (gfc_int4_type_node);
KABOOOMMMMMM.
kargl[217] gfc41 -static -o z -fdump-tree-original a.f90
a.f90: In function 'MAIN__':
a.f90:4: internal compiler error: in gimplify_expr, at gimplify.c:4305
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
kargl[219] cat a.f90
program a
real, allocatable :: b(:)
allocate(b(3))
deallocate(b)
end program a
kargl[220] more a.f90.t02.original
{
real4[0:] * * ptr.0;
ptr.0 = &b.data;
_gfortran_deallocate (ptr.0, int4 *);
}
This is obviously wrong. Sigh, I guess I'll waste another hour
of time trying to determine how to transmute the above into
_gfortran_deallocate (ptr.0, (int4 *) NULL);
--
Steve