aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-05-28 07:56:12 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-06-01 18:13:24 -0700
commit4856affe9e08a3562792d6cde217cd06c1ef93da (patch)
treefcc8495fe94dcf8dea3de48c39d6e9eb6b0d8e0e /gcc
parent9e734259dc4b15982727697d88d59170e71de53d (diff)
downloadgcc-4856affe9e08a3562792d6cde217cd06c1ef93da.zip
gcc-4856affe9e08a3562792d6cde217cd06c1ef93da.tar.gz
gcc-4856affe9e08a3562792d6cde217cd06c1ef93da.tar.bz2
Fortran: Adjust handling of optional comma in FORMAT.
This change adjusts the error messages for optional commas in format strings to give a warning at compile time unless -std=legacy is used. This is more consistant with the runtime library. A missing comma separator should not be encouraged as it is non-standard fortran. PR fortran/119856 gcc/fortran/ChangeLog: * io.cc: Set missing comma error checks to STD_STD_LEGACY. gcc/testsuite/ChangeLog: * gfortran.dg/comma_format_extension_1.f: Update dg-options to "-std=legacy". * gfortran.dg/comma_format_extension_3.f: Likewise. * gfortran.dg/continuation_13.f90: Likewise. (cherry picked from commit e2bf0b3910de7e65363435f0a7fa606e2448a677)
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/io.cc6
-rw-r--r--gcc/testsuite/gfortran.dg/comma_format_extension_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/comma_format_extension_3.f2
-rw-r--r--gcc/testsuite/gfortran.dg/continuation_13.f902
4 files changed, 7 insertions, 5 deletions
diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc
index b5c9d33..7466d8f 100644
--- a/gcc/fortran/io.cc
+++ b/gcc/fortran/io.cc
@@ -1228,7 +1228,8 @@ between_desc:
default:
if (mode != MODE_FORMAT)
format_locus.nextc += format_string_pos - 1;
- if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus))
+ if (!gfc_notify_std (GFC_STD_LEGACY,
+ "Missing comma in FORMAT string at %L", &format_locus))
return false;
/* If we do not actually return a failure, we need to unwind this
before the next round. */
@@ -1290,7 +1291,8 @@ extension_optional_comma:
default:
if (mode != MODE_FORMAT)
format_locus.nextc += format_string_pos;
- if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus))
+ if (!gfc_notify_std (GFC_STD_LEGACY,
+ "Missing comma in FORMAT string at %L", &format_locus))
return false;
/* If we do not actually return a failure, we need to unwind this
before the next round. */
diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
index a3a5a98..c4b43f0 100644
--- a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
+++ b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "" }
+! { dg-options "-std=legacy" }
! test that the extension for a missing comma is accepted
subroutine mysub
diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
index 0b00224..9d974d6 100644
--- a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
+++ b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
@@ -3,7 +3,7 @@
! did do the correct thing at runtime.
! Note the missing , before i1 in the format.
! { dg-do run }
-! { dg-options "" }
+! { dg-options "-std=legacy" }
character*12 c
write (c,100) 0, 1
diff --git a/gcc/testsuite/gfortran.dg/continuation_13.f90 b/gcc/testsuite/gfortran.dg/continuation_13.f90
index 9799b59e..475c896 100644
--- a/gcc/testsuite/gfortran.dg/continuation_13.f90
+++ b/gcc/testsuite/gfortran.dg/continuation_13.f90
@@ -1,5 +1,5 @@
! { dg-do run }
-! { dg-options "-std=gnu" }
+! { dg-options "-std=legacy" }
! PR64506
character(25) :: astring