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: Fix a function decl in gfortran


On 05/27/2014 04:01 PM, Tobias Burnus wrote:
Bernd Schmidt wrote:
Compiling Fortran code with the ptx backend I'm working on results in
assembler warnings about mismatch between function calls and function decls.

Bootstrapped and tested on x86_64-linux. Ok?

OK.

The change/bug is due to my fortran-caf -> trunk patch at
https://gcc.gnu.org/ml/fortran/2014-04/msg00091.html,
which seemingly missed the function declaration when updating the calls and
the library.

There's at least one more such problem with gfortran, which I'm having a harder time debugging. It occurs in gfortran.fortran-torture/compile/mloc.f90 for the library function mminloc0_4_r4. We have a decl that shows four arguments:

(gdb) p debug_tree (type)
 <function_type
    type <void_type void VOID
        align 8 symtab 0 alias set -1 canonical type
        pointer_to_this <pointer_type >>
    SI
    size <integer_cst type <integer_type bitsizetype> constant 32>
    unit size <integer_cst type <integer_type sizetype> constant 4>
    align 32 symtab 0 alias set -1 canonical type
    attributes <tree_list
        purpose <identifier_node fn spec>
        value <tree_list
            value <string_cst constant ".wrrr">>>
    arg-types <tree_list
        value <reference_type type <record_type  array1_integer(kind=4)>
            unsigned DI
            size <integer_cst  constant 64>
            unit size <integer_cst constant 8>
            align 64 symtab 0 alias set -1 canonical type>
        chain <tree_list value <reference_type>
            chain <tree_list value <pointer_type>
                chain <tree_list value <pointer_type>
                    chain <tree_list value <void_type>>>>>>>

while the actual library function (and the call to it) only has three arguments:
void
mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
        gfc_array_r4 * const restrict array,
        gfc_array_l1 * const restrict mask)

The decl is constructed by gfc_get_function_type. It seems to think there's one extra parameter named "dim" between "array" and "mask". Another clue might be the following printout:

(gdb) p gfc_debug_expr(gfc_expr*) (expr)
_gfortran_mminloc0_4_r4[[((MAIN__:b(FULL)) ((arg not-present)) (__convert_l4_l1[[(((< MAIN__:b(FULL) )))]]))]]

which says "arg not-present", presumably for this "dim" argument.

From there I'm unable to determine what's wrong due to lack of Fortran knowledge - any ideas?


Bernd


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