This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[gfortran,patch] PR 25716: Implicit kind conversions in in expressions written to *.mod-files


:ADDPATCH fortran:

Here's a patch for PR 25716, a problem uncovered by the testcase
char_result_11.f90 on 64-bit processors.  The problem was
writting expressions containing function nodes calling a
__convert_X_Y function (to convert from from one type/kind to
another).  There where two problems with these nodes:

1) In resolve.c (gfc_resolve_index), when we create the type-spec
for the expression node, we don't initialize it properly, leaving
ts->cl non-NULL when it should be NULL.  Fixed by inserting a
call to gfc_clear_ts().

2) The expression node didn't get a symtree, which caused
problems in module.c (mio_expr) for function nodes when we call
mio_symtree_ref().  To fix this I inserted code to add a symtree
in intrinsic.c (gfc_convert_type_warn).  To make this work I had
to fix two other things as well:  

        a) Remove a symbol from the 'changed_syms' list when we
        free it in symbol.c (gfc_free_symbol) 

        b) In intrinsic.c (gfc_find_function), look for the
        function in the table 'conversion', if not found in
        the table 'functions'.

I do not provide a separate testcase for this, instead I've
modified char_result_11.f90 to fail (without this patch) an all
systems, by declaring some of the integer variables to have
kind=1 (which will induce kind-conversions where these variables
are used as array indeces; I presume that array index kind is
different from 1 on all systems.).  In addition I changed it from
{ dg-do compile } to { dg-do link }, because a problem with an
earlier version of the patch didn't turn up until linking.

I have regression tested the patch on Linux/x86, on 4.2 and 4.1.
In addition I have tested a few selected testcases on a cross
compiler to SPARC64, and in a comment in bugzilla Eric Botcazou
says the he has run the testsuite on 32-bit and 64-bit SPARC.

Ok to commit?


        Erik


2005-01-15  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/25716
        * intrinsic.c (gfc_find_function): Search in 'conversion'
        if not found in 'functions'.
        (gfc_convert_type_warn): Add a symtree to the new
        expression node.
        * symbol.c (remove_from_changed_syms): New function.
        (gfc_free_symbol): Use it.
        * resolve.c (gfc_resolve_index): Clear the type-spec of
        the expression node first.


2005-01-15  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/25716
        * gfortran.dg/char_result_11.f90: Make it sensitive to PR
        25716 on 32-bit systems too.

Attachment: 25716.diff
Description: Text document


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