[PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

Mark Eggleston
The attached patch treats the intrinsic SIGN in the same way as MOD and
DIM as it has the same arguments.

Tested using make -j 8 check-fortran on x86_64

Conditional compilation using #ifdef __GFC_REAL_16__ has been employed
where appropriate in the test cases so should be OK on platforms without
REAL(16).

Change logs:

gcc/fortran

     Mark Eggleston  <[hidden email]>

     PR fortran/89286
         * check.c (gfc_check_sign): Deleted.
     * intrinsic.c (add_functions): Call add_sym_2 with gfc_check_a_p
     instead of gfc_check_sign for "sign".
     * intrinsic.h: Remove declaration of gfc_check_sign.
     * iresolve.c (gfc_resolve_sign): Check for largest kind of the actual
     arguments and convert the smaller. Set return kind to be the largest.
     * simplify.c (gfc_simplify_sign): Use the largest kind of the actual
     arguments for return
     * intrinsic.texi: Add GNU extension notes for return value to SIGN.

gcc/testsuite

     Mark Eggleston <[hidden email]>

     PR fortran/89240
     * gfortran.dg/sign_gnu_extension_1.f90: New test.
     * gfortran.dg/sign_gnu_extension_2.f90: New test.
     * gfortran.dg/pr78619.f90: Check for "must have" instead of "must be".

If OK please can someone commit as I do not have the privileges.

--
https://www.codethink.co.uk/privacy.html


0001-Intrinsic-sign-and-GNU-extension.patch (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

Bernhard Reutner-Fischer
On 10 July 2019 17:52:40 CEST, Steve Kargl <[hidden email]> wrote:

>On Wed, Jul 10, 2019 at 02:50:47PM +0100, Mark Eggleston wrote:
>> The attached patch treats the intrinsic SIGN in the same way as MOD
>and
>> DIM as it has the same arguments.
>>
>> Tested using make -j 8 check-fortran on x86_64
>>
>> Conditional compilation using #ifdef __GFC_REAL_16__ has been
>employed
>> where appropriate in the test cases so should be OK on platforms
>without
>> REAL(16).
>>
>> Change logs:
>>
>> gcc/fortran
>>
>>      Mark Eggleston  <[hidden email]>
>>
>>      PR fortran/89286
>>          * check.c (gfc_check_sign): Deleted.

ChangeLog has to be in present tense per convention.

>>      * intrinsic.c (add_functions): Call add_sym_2 with gfc_check_a_p
>>      instead of gfc_check_sign for "sign".
>>      * intrinsic.h: Remove declaration of gfc_check_sign.
>>      * iresolve.c (gfc_resolve_sign): Check for largest kind of the
>actual
>>      arguments and convert the smaller. Set return kind to be the
>largest.
>>      * simplify.c (gfc_simplify_sign): Use the largest kind of the
>actual
>>      arguments for return
>>      * intrinsic.texi: Add GNU extension notes for return value to
>SIGN.
>>
>> gcc/testsuite
>>
>>      Mark Eggleston <[hidden email]>
>>
>>      PR fortran/89240
>>      * gfortran.dg/sign_gnu_extension_1.f90: New test.
>>      * gfortran.dg/sign_gnu_extension_2.f90: New test.
>>      * gfortran.dg/pr78619.f90: Check for "must have" instead of
>"must be".
>>
>> If OK please can someone commit as I do not have the privileges.
>>
>
>We really need to get you commit access to the tree.
>
>I also am not a fan of this type of change.  Having spent the
>last few days working on fixing BOZ to conform to F2018, I'm
>finding all sorts of undocumented "extensions".  Personally,
>I think gfortran should be moving towards the standard by
>deprecating of these types of extensions.

At least make them explicit under explicit extension or at least -legacy or whatever its called.

thanks,

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

Mark Eggleston

On 10/07/2019 17:20, Bernhard Reutner-Fischer wrote:

> On 10 July 2019 17:52:40 CEST, Steve Kargl <[hidden email]> wrote:
>> On Wed, Jul 10, 2019 at 02:50:47PM +0100, Mark Eggleston wrote:
>>> The attached patch treats the intrinsic SIGN in the same way as MOD
>> and
>>> DIM as it has the same arguments.
>>>
>>> Tested using make -j 8 check-fortran on x86_64
>>>
>>> Conditional compilation using #ifdef __GFC_REAL_16__ has been
>> employed
>>> where appropriate in the test cases so should be OK on platforms
>> without
>>> REAL(16).
>>>
>>> Change logs:
>>>
>>> gcc/fortran
>>>
>>>       Mark Eggleston  <[hidden email]>
>>>
>>>       PR fortran/89286
>>>           * check.c (gfc_check_sign): Deleted.
> ChangeLog has to be in present tense per convention.
>
>>>       * intrinsic.c (add_functions): Call add_sym_2 with gfc_check_a_p
>>>       instead of gfc_check_sign for "sign".
>>>       * intrinsic.h: Remove declaration of gfc_check_sign.
>>>       * iresolve.c (gfc_resolve_sign): Check for largest kind of the
>> actual
>>>       arguments and convert the smaller. Set return kind to be the
>> largest.
>>>       * simplify.c (gfc_simplify_sign): Use the largest kind of the
>> actual
>>>       arguments for return
>>>       * intrinsic.texi: Add GNU extension notes for return value to
>> SIGN.
>>> gcc/testsuite
>>>
>>>       Mark Eggleston <[hidden email]>
>>>
>>>       PR fortran/89240
>>>       * gfortran.dg/sign_gnu_extension_1.f90: New test.
>>>       * gfortran.dg/sign_gnu_extension_2.f90: New test.
>>>       * gfortran.dg/pr78619.f90: Check for "must have" instead of
>> "must be".
>>> If OK please can someone commit as I do not have the privileges.
>>>
>> We really need to get you commit access to the tree.
>>
>> I also am not a fan of this type of change.  Having spent the
>> last few days working on fixing BOZ to conform to F2018, I'm
>> finding all sorts of undocumented "extensions".  Personally,
>> I think gfortran should be moving towards the standard by
>> deprecating of these types of extensions.

I agree.

I think that -std=gnu should not be the default, if gnu extensions are
required you have to ask for them.

> At least make them explicit under explicit extension or at least -legacy or whatever its called.
>
> thanks,

I agree, at the moment the GNU extension is silently supported by DIM
and MOD

>
>
--
https://www.codethink.co.uk/privacy.html

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

Jeff Law
In reply to this post by Mark Eggleston
On 7/10/19 9:52 AM, Steve Kargl wrote:

> On Wed, Jul 10, 2019 at 02:50:47PM +0100, Mark Eggleston wrote:
>> The attached patch treats the intrinsic SIGN in the same way as MOD and
>> DIM as it has the same arguments.
>>
>> Tested using make -j 8 check-fortran on x86_64
>>
>> Conditional compilation using #ifdef __GFC_REAL_16__ has been employed
>> where appropriate in the test cases so should be OK on platforms without
>> REAL(16).
>>
>> Change logs:
>>
>> gcc/fortran
>>
>>      Mark Eggleston  <[hidden email]>
>>
>>      PR fortran/89286
>>          * check.c (gfc_check_sign): Deleted.
>>      * intrinsic.c (add_functions): Call add_sym_2 with gfc_check_a_p
>>      instead of gfc_check_sign for "sign".
>>      * intrinsic.h: Remove declaration of gfc_check_sign.
>>      * iresolve.c (gfc_resolve_sign): Check for largest kind of the actual
>>      arguments and convert the smaller. Set return kind to be the largest.
>>      * simplify.c (gfc_simplify_sign): Use the largest kind of the actual
>>      arguments for return
>>      * intrinsic.texi: Add GNU extension notes for return value to SIGN.
>>
>> gcc/testsuite
>>
>>      Mark Eggleston <[hidden email]>
>>
>>      PR fortran/89240
>>      * gfortran.dg/sign_gnu_extension_1.f90: New test.
>>      * gfortran.dg/sign_gnu_extension_2.f90: New test.
>>      * gfortran.dg/pr78619.f90: Check for "must have" instead of "must be".
>>
>> If OK please can someone commit as I do not have the privileges.
>>
>
> We really need to get you commit access to the tree.
I will handle that directly with Mark.

>
> I also am not a fan of this type of change.  Having spent the
> last few days working on fixing BOZ to conform to F2018, I'm
> finding all sorts of undocumented "extensions".  Personally,
> I think gfortran should be moving towards the standard by
> deprecating of these types of extensions.
I'd tend to agree.  The problem is getting real world codebases moved
can be exceedingly difficult.  At the very least these extensions should
be behind suitable flags IMHO.

jeff

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH PR Fortran/89286] Intrinsic sign and GNU Extension

Jeff Law
In reply to this post by Mark Eggleston
On 7/10/19 7:50 AM, Mark Eggleston wrote:

> The attached patch treats the intrinsic SIGN in the same way as MOD and
> DIM as it has the same arguments.
>
> Tested using make -j 8 check-fortran on x86_64
>
> Conditional compilation using #ifdef __GFC_REAL_16__ has been employed
> where appropriate in the test cases so should be OK on platforms without
> REAL(16).
>
> Change logs:
>
> gcc/fortran
>
>     Mark Eggleston  <[hidden email]>
>
>     PR fortran/89286
>         * check.c (gfc_check_sign): Deleted.
>     * intrinsic.c (add_functions): Call add_sym_2 with gfc_check_a_p
>     instead of gfc_check_sign for "sign".
>     * intrinsic.h: Remove declaration of gfc_check_sign.
>     * iresolve.c (gfc_resolve_sign): Check for largest kind of the actual
>     arguments and convert the smaller. Set return kind to be the largest.
>     * simplify.c (gfc_simplify_sign): Use the largest kind of the actual
>     arguments for return
>     * intrinsic.texi: Add GNU extension notes for return value to SIGN.
>
> gcc/testsuite
>
>     Mark Eggleston <[hidden email]>
>
>     PR fortran/89240
>     * gfortran.dg/sign_gnu_extension_1.f90: New test.
>     * gfortran.dg/sign_gnu_extension_2.f90: New test.
>     * gfortran.dg/pr78619.f90: Check for "must have" instead of "must be".
>
> If OK please can someone commit as I do not have the privileges.
>
So FWIW, this is in my tester now too.

jeff