[patch, fortran, committed] Fix PR 96220, error with -fc-prototypes

Thomas Koenig tkoenig@netcologne.de
Sun Jul 19 15:38:11 GMT 2020


Hello world,

I have just committed the attached patch as simple and obvoius.
The problem was that, for a test case like

module f_global_vars_m
use, intrinsic :: iso_c_binding, sp => c_float, dp => c_double
implicit none
real(dp), bind(c) :: one= 1.0_dp, four= 4.0_dp
end module f_global_vars_m

the code tried to look up the name of the C type in "dp", not
in "c_double".  I removed the code which did the wrong thing,
and let the code that was already there do the work.

I will also backport to gcc 10 and 9 as soon as gcc 10 reopens.

No test case because we can not really test for this (but maybe
we should dump to files instead of standard output for
several of the things that we do dump).

Regards

	Thomas


Always use name from c_interop_kinds_table for -fc-prototypes.

When a user specified a KIND that was a parameter taking the value
of an iso_c_binding KIND, the code used the name of that parameter
to look up the type name.  Corrected by always looking it up in
the table of C interop kinds (which was previously done for
non-C-interop types, anyway).

gcc/fortran/ChangeLog:

         PR fortran/96220
         * dump-parse-tree.c (get_c_type_name): Always use the entries from
         c_interop_kinds_table to find the correct C type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1.diff
Type: text/x-patch
Size: 2657 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200719/97c5041f/attachment.bin>


More information about the Gcc-patches mailing list