Bug 84519 - [F2018] STOP and ERROR STOP statements with QUIET specifier
Summary: [F2018] STOP and ERROR STOP statements with QUIET specifier
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 12.0
Assignee: anlauf
URL:
Keywords:
Depends on:
Blocks: F2018
  Show dependency treegraph
 
Reported: 2018-02-22 18:06 UTC by Janne Blomqvist
Modified: 2022-02-24 20:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-02-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janne Blomqvist 2018-02-22 18:06:56 UTC
In F2018 the STOP and ERROR STOP statements take and extra QUIET= specifier, a logical value determining whether any information should be printed to the screen or not.

For GCC 8, it would be good to have this in the library API even though the parsing could well be postponed to a later release.
Comment 1 Janne Blomqvist 2018-02-22 19:17:01 UTC
Working on a patch, assigning to myself.
Comment 2 Janne Blomqvist 2018-02-23 09:07:56 UTC
Author: jb
Date: Fri Feb 23 09:07:24 2018
New Revision: 257928

URL: https://gcc.gnu.org/viewcvs?rev=257928&root=gcc&view=rev
Log:
PR 84519 Handle optional QUIET specifier for STOP and ERROR STOP

Fortran 2018 adds a new QUIET specifier for the STOP and ERROR STOP
statements, in order to suppress the printing of signaling FP
exceptions and the stop code. This patch adds the necessary library
changes, but for now the new specifier is not parsed and the frontend
unconditionally adds a false value for the new argument.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2018-02-23  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/84519
	* trans-decl.c (gfc_build_builtin_function_decls): Add bool
	argument to stop and error stop decls.
	* trans-stmt.c (gfc_trans_stop): Add false value to argument
	lists.

libgfortran/ChangeLog:

2018-02-23  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/84519
	* caf/libcaf.h (_gfortran_caf_stop_numeric): Add bool argument.
	(_gfortran_caf_stop_str): Likewise.
	(_gfortran_caf_error_stop_str): Likewise.
	(_gfortran_caf_error_stop): Likewise.
	* caf/mpi.c (_gfortran_caf_error_stop_str): Handle new argument.
	(_gfortran_caf_error_stop): Likewise.
	* caf/single.c (_gfortran_caf_stop_numeric): Likewise.
	(_gfortran_caf_stop_str): Likewise.
	(_gfortran_caf_error_stop_str): Likewise.
	(_gfortran_caf_error_stop): Likewise.
	(_gfortran_caf_lock): Likewise.
	(_gfortran_caf_unlock): Likewise.
	* libgfortran.h (stop_string): Add bool argument.
	* runtime/pause.c (do_pause): Add false argument.
	* runtime/stop.c (stop_numeric): Handle new argument.
	(stop_string): Likewise.
	(error_stop_string): Likewise.
	(error_stop_numeric): Likewise.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/libgfortran/caf/libcaf.h
    trunk/libgfortran/caf/mpi.c
    trunk/libgfortran/caf/single.c
    trunk/libgfortran/libgfortran.h
    trunk/libgfortran/runtime/pause.c
    trunk/libgfortran/runtime/stop.c
Comment 3 Janne Blomqvist 2018-02-23 11:53:58 UTC
Unassigning myself in case someone else wants to tackle the parsing part for GCC 9.
Comment 4 anlauf 2022-02-22 20:36:36 UTC
I'm working on a patch that is nearly complete.
Comment 5 anlauf 2022-02-23 22:22:52 UTC
Patch submitted: https://gcc.gnu.org/pipermail/fortran/2022-February/057588.html
Comment 6 GCC Commits 2022-02-24 19:57:16 UTC
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:916b809fbfdd2740006270baf549bf22fe9ec3c4

commit r12-7377-g916b809fbfdd2740006270baf549bf22fe9ec3c4
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Feb 23 23:08:29 2022 +0100

    Fortran: frontend code for F2018 QUIET specifier to STOP and ERROR STOP
    
    Fortran 2018 allows for a QUIET specifier to the STOP and ERROR STOP
    statements.  Whilst the gfortran library code provides support for this
    specifier for quite some time, the frontend implementation was missing.
    
    gcc/fortran/ChangeLog:
    
            PR fortran/84519
            * dump-parse-tree.cc (show_code_node): Dump QUIET specifier when
            present.
            * match.cc (gfc_match_stopcode): Implement parsing of F2018 QUIET
            specifier.  F2018 stopcodes may have non-default integer kind.
            * resolve.cc (gfc_resolve_code): Add checks for QUIET argument.
            * trans-stmt.cc (gfc_trans_stop): Pass QUIET specifier to call of
            library function.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/84519
            * gfortran.dg/stop_1.f90: New test.
            * gfortran.dg/stop_2.f: New test.
            * gfortran.dg/stop_3.f90: New test.
            * gfortran.dg/stop_4.f90: New test.
Comment 7 anlauf 2022-02-24 20:08:21 UTC
Finished on mainline for gcc-12.  Closing.