Bug 61429 - SYSTEM_CLOCK used with non-default integer kind does not produce warning
Summary: SYSTEM_CLOCK used with non-default integer kind does not produce warning
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: 5.0
Assignee: Francois-Xavier Coudert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-06 15:13 UTC by Jacob Abel
Modified: 2014-06-15 17:01 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-06-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Abel 2014-06-06 15:13:26 UTC
Compiling:

program main
implicit none
integer(kind=8) :: i
call system_clock(i)
end program main

with gfortran -std=f95 -pedantic -Wall -Wextra produces no warning. According to the F95 standard (13.14.106), "COUNT (optional) shall be scalar and of type default integer" (it's the same for COUNT_RATE and COUNT_MAX). It's not until F2003 (13.7.117) that the wording is changed to "COUNT (optional) shall be scalar and of type integer."

Summary: using any other kind but default integer with system_clock should not be allowed or give a warning under -std=f95, but should be allowed for -std=f2003 and later.
Comment 1 kargls 2014-06-06 17:20:38 UTC
I have a patch.
Comment 2 Francois-Xavier Coudert 2014-06-15 16:59:25 UTC
Author: fxcoudert
Date: Sun Jun 15 16:58:53 2014
New Revision: 211686

URL: https://gcc.gnu.org/viewcvs?rev=211686&root=gcc&view=rev
Log:
	PR fortran/28484
	PR fortran/61429

	* check.c (gfc_check_system_clock): Improve checking of arguments.
	* intrinsic.texi: Update doc of SYSTEM_CLOCK.
	* iresolve.c (gfc_resolve_system_clock): Choose library function
	used depending on argument kinds.
	* trans-decl.c (gfc_build_intrinsic_function_decls): Build
	decls for system_clock_4 and system_clock_8.
	* trans-intrinsic.c (conv_intrinsic_system_clock): New function.
	(gfc_conv_intrinsic_subroutine): Call conv_intrinsic_system_clock.
	* trans.h (gfor_fndecl_system_clock4, gfor_fndecl_system_clock8):
	New variables.

	* gfortran.dg/system_clock_1.f90: New file.
	* gfortran.dg/system_clock_2.f90: New file.

Added:
    trunk/gcc/testsuite/gfortran.dg/system_clock_1.f90
    trunk/gcc/testsuite/gfortran.dg/system_clock_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog
Comment 3 Francois-Xavier Coudert 2014-06-15 17:01:58 UTC
Fixed on trunk (4.10).