This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR 82143: add a -fdefault-real-16 flag
2017-09-21 22:38 GMT+02:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> On Thu, Sep 21, 2017 at 09:10:42AM +0200, Janus Weil wrote:
>> Attached is an updated patch, where I'm adding -fdefault-real-10
>> according to Steve's suggestion. As with -fdefault-real-8 and
>> -fdefault-real-16, I'm choosing to set the double kind to 16 in this
>> case. Also I'm renaming flag_default_real to flag_default_real_8 (for
>> symmetry reasons and to make the code more readable). Finally I'm
>> removing the restriction that -fdefault-double-8 must occur together
>> with -fdefault-real-8. It may be useful on its own and should be
>> combinable with the new flags.
>>
>> Ok for trunk?
>>
>
> Although I would prefer these options to be deprecated,
> I did read the patch and it appears to be correct. So,
> I suppose it's ok for trunk.
Thanks, Steve. I'm attaching the updated ChangeLog and the two test
cases for the two new flags. Since this appears to be a somewhat
controversial feature, I'll wait two more days to allow for others to
contribute their feedback (positive or negative). I'll commit on
Sunday if I hear nothing until then.
Cheers,
Janus
2017-09-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143
* lang.opt: Add the options -fdefault-real-10 and -fdefault-real-16.
Rename flag_default_real to flag_default_real_8.
* invoke.texi: Add documentation.
* module.c (use_iso_fortran_env_module): flag_default_real is renamed.
* trans-types.c (gfc_init_kinds): Implement the flags
-fdefault-real-10 and -fdefault-real-16. Make -fdefault-double-8 work
without -fdefault-real-8.
2017-09-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143
* gfortran.dg/promotion_3.f90: New test case.
* gfortran.dg/promotion_4.f90: New test case.
! { dg-do run }
! { dg-options "-fdefault-real-16" }
!
! PR 82143: add a -fdefault-real-16 flag
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
real :: r
real(kind=4) :: r4
real(kind=8) :: r8
double precision :: d
if (kind(r4) /= 4) call abort
if (kind(r8) /= 8) call abort
if (kind(r) /= 16) call abort
if (kind(d) /= 16) call abort
end
! { dg-do run }
! { dg-options "-fdefault-real-10" }
!
! PR 82143: add a -fdefault-real-16 flag
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
real :: r
real(kind=4) :: r4
real(kind=8) :: r8
double precision :: d
if (kind(r4) /= 4) call abort
if (kind(r8) /= 8) call abort
if (kind(r) /= 10) call abort
if (kind(d) /= 16) call abort
end