[PATCH, Fortran] Allow CHARACTER literals in assignments and DATA statements

Tobias Burnus tobias@codesourcery.com
Fri Nov 8 10:17:00 GMT 2019


On 11/8/19 10:45 AM, Mark Eggleston wrote:
> PING - OK, to commit? I have a pending patch that needs this in place. 
Thanks for the ping. — Any chance, that you also work on some of the 
general issues once in a while (cf. Bugzilla remark below); e.g. one bug 
per week or fortnight? (Can be a simple one, just not to keep the number 
of bugs growing.)

@Anyone – side question: Are there other pending patches? Ignoring one 
OpenMP and several OpenACC patches, I am currently aware of:
* [Needs review] José's PR92142 - CFI_setpointer corrupts descriptor 
patch [FSF copyright assignment exists]
* [Nearly ready, but needs fixes/follow-up patch] Steve's PR91178 for 
code like 'call foo(a, (a))'
* [Approved but not committed] Paul's PR92123 patch for bind(C) + alloc 
scalars.

Side remark: On the bind(C) side, I think PR 92189 should be fixed. 
Additionally, there are several recent reports on segfaults and 
regressions, looking Bugzilla (component = fortran, sort by change data).


Back to this pending patch:

On 11/5/19 10:55 AM, Mark Eggleston wrote:
> I noticed that warning were not produced for conversion to logicals, 
> re-ordering of an if..else if sequence fixes that problem. Additional 
> test cases have been added.
Looks as if reviewing and revisiting the patch was worthwhile :-) Thanks!

> Please find attached the updated patch, the change logs follow. OK to 
> commit?

LGTM. Thanks for patch.

Cheers,

Tobias

PS: I still find it interesting, which Fortran code gets used; from a 
supercomputing centre, I heard that everything between 
afterwards-never-touched FORTRAN IV code to code using the latest 
Fortran features is used. (But most amazing I find code, which gets 
newly written in a FORTRAN 66 style/features with some sparse F20xx 
features in between – like the "publicx" example of recently [instead of 
'public x' or 'public::x'; spaces aren't that expensive anymore].)


> gcc/fortran/ChangeLog
>
>     Jim MacArthur  <jim.macarthur@codethink.co.uk>
>     Mark Eggleston  <mark.eggleston@codethink.com>
>
>     * arith.c (hollerith2representation): Use 
> OPT_Wcharacter_truncation in
>     call to gfc_warning.  Add character2representation, 
> gfc_character2int,
>     gfc_character2real, gfc_character2complex and gfc_character2logical.
>     * arith.h: Add prototypes for gfc_character2int, gfc_character2real,
>     gfc_character2complex and gfc_character2logical.
>     * expr.c (gfc_check_assign): Return true if left hand side is numeric
>     or logical and the right hand side is character and of kind=1.
>     * gfortran.texi: Add -fdec-char-conversions.
>     * intrinsic.c (add_conversions): Add conversions from character to
>     integer, real, complex and logical types for their supported kinds.
>     (gfc_convert_type_warn): Reorder if..else if.. sequence so that 
> warnings
>     are produced for conversion to logical.
>     * invoke.texi: Add option to list of options.
>     * invoke.texi: Add Character conversion subsection to Extensions
>     section.
>     * lang.opt: Add new option.
>     * options.c (set_dec_flags): Add SET_BITFLAG for
>     flag_dec_char_conversions.
>     * resolve.c (resolve_ordindary_assign): Issue error if the left hand
>     side is numeric or logical and the right hand side is a character
>     variable.
>     * simplify.c (gfc_convert_constant): Assign the conversion function
>     depending on destination type.
>     * trans-const.c (gfc_constant_to_tree): Use OPT_Wsurprising in
>     gfc_warning allowing the warning to be switched off only if
>     flag_dec_char_conversions is enabled.
>
> gcc/testsuite/gfortran.dg
>
>     Jim MacArthur <jim.macarthur@codethink.co.uk>
>     Mark Eggleston <mark.eggleston@codethink.com>
>
>     PR fortran/89103
>     * gfortran.dg/dec_char_conversion_in_assignment_1.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_2.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_3.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_4.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_5.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_6.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_7.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_assignment_8.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_1.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_2.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_3.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_4.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_5.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_6.f90: New test.
>     * gfortran.dg/dec_char_conversion_in_data_7.f90: New test.
>     * gfortran.dg/hollerith5.f90: Add -Wsurprising to options.
>     * gfortran.dg/hollerith_legacy.f90: Add -Wsurprising to options.
>     * gfortran.dg/no_char_to_numeric_assign.f90: New test.



More information about the Gcc-patches mailing list