aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-05-31 08:57:22 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-06-01 18:15:21 -0700
commit21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364 (patch)
tree1b2660015329d82f29cf416f41627195cac47171 /gcc
parent4856affe9e08a3562792d6cde217cd06c1ef93da (diff)
downloadgcc-21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364.zip
gcc-21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364.tar.gz
gcc-21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364.tar.bz2
Fortran: Fix handling of parsed format strings.
Previously parsed strings with errors were being cached such that subsequent use of the format string were not being checked for errors. PR libfortran/119856 libgfortran/ChangeLog: * io/format.c (parse_format_list): Set the fmt->error message for missing comma. (parse_format): Do not cache the parsed format string if a previous error ocurred. gcc/testsuite/ChangeLog: * gfortran.dg/pr119856.f90: New test. (cherry picked from commit 5ff48aabf76c8913c013f233d3f42bb217a16e7b)
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/pr119856.f9015
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr119856.f90 b/gcc/testsuite/gfortran.dg/pr119856.f90
new file mode 100644
index 0000000..60ada0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr119856.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! PR119856, the error should occur in both write statements.
+program badfmt
+ implicit none
+
+ character(10):: fmt = "(AI5)" ! Not a PARAMETER so not examined
+ ! at compile time
+ integer :: ioerr
+ ioerr = 0
+ write (*, fmt, iostat=ioerr) 'value =', 42
+ if (ioerr /= 5006) stop 10
+!
+ write (*, fmt, iostat=ioerr) 'value =', 43
+ if (ioerr /= 5006) stop 13
+end program badfmt