public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics
@ 2020-08-12  6:53 markeggleston at gcc dot gnu.org
  2021-02-22  5:42 ` [Bug fortran/96580] " jvdelisle at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: markeggleston at gcc dot gnu.org @ 2020-08-12  6:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

            Bug ID: 96580
           Summary: F2018 changes to date_and_time intrinsics
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markeggleston at gcc dot gnu.org
            Blocks: 85836
  Target Milestone: ---

Prior to Fortran 2018:

VALUES (optional) shall be a rank-one default integer array. It is an INTENT
(OUT) argument. Its size shall be at least 8.

Fortran 2018:

VALUES (optional) shall be a rank-one array of type integer with a decimal
exponent range of at least four. It is an INTENT (OUT) argument. Its size shall
be at least 8.

For -std=f2008 and earlier arrays of integer type of other than default kind
should be rejected as the value argument. Currently 11.0 compiles with integers
of kind other than default including integer(1).

For -std=f2018 and -std=gnu arrays of integer type with kinds 2 and greater are
allowed, integer(1) is rejected.

Currently there are issues with gfortran manual documentation:

- minimum sizes are specified for the character arguments date, time and zones,
the standards do not specify a minimum size and gfortran allows smaller sizes.
- the VALUES argument is described as (Optional) The type shall be INTEGER(8),
which implies a scalar integer of kind 8.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85836
[Bug 85836] [meta-bug] Fortran 2018 support

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
@ 2021-02-22  5:42 ` jvdelisle at gcc dot gnu.org
  2021-02-22 16:14 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2021-02-22  5:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot gnu.org

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I was playing around with this just to see what happens:

program test_time_and_date
    character(8)  :: date
    character(10) :: time
    character(5)  :: zone
    integer(2),dimension(8) :: values
    ! using keyword arguments
    call date_and_time(date,time,zone,values)
    call date_and_time(DATE=date,ZONE=zone)
    call date_and_time(TIME=time)
    call date_and_time(VALUES=values)
    print '(a,2x,a,2x,a)', date, time, zone
    print *, "---------------------"
    print '(8i5)', values
end program test_time_and_date

Using integer(2):

$ gfc -g -static pr96580.f90 
$ $ gfc -Wall -fcheck=all pr96580.f90
$
 Compiles without indication of an issue.

 However, segfaults. Not really surprising, but maybe we ought to detect or
reject the code.

(gdb) r
Starting program: /home/jerry/dev/test/pr96580/a.out 

Program received signal SIGABRT, Aborted.
0x0000000000443585 in raise ()
(gdb) bt
#0  0x0000000000443585 in raise ()
#1  0x00000000004012cb in abort ()
#2  0x000000000040110a in _gfortran_date_and_time (__date=<optimized out>, 
    __time=<optimized out>, __zone=<optimized out>, __values=<optimized out>, 
    __date_len=<optimized out>, __time_len=<optimized out>, __zone_len=5)
    at ../../../trunk/libgfortran/intrinsics/date_and_time.c:227
#3  0x0000000000402267 in test_time_and_date () at pr96580.f90:7
#4  0x00000000004025ba in main (argc=1, argv=0x7fffffffd9c6) at pr96580.f90:14
#5  0x000000000043cf6a in __libc_start_main ()
#6  0x00000000004020be in _start ()

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
  2021-02-22  5:42 ` [Bug fortran/96580] " jvdelisle at gcc dot gnu.org
@ 2021-02-22 16:14 ` dominiq at lps dot ens.fr
  2023-12-17 22:16 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-02-22 16:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2021-02-22

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAICT the testing comment 2 works with integer(2) replaced with integer(4) or
integer(8), but not with integer(16).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
  2021-02-22  5:42 ` [Bug fortran/96580] " jvdelisle at gcc dot gnu.org
  2021-02-22 16:14 ` dominiq at lps dot ens.fr
@ 2023-12-17 22:16 ` anlauf at gcc dot gnu.org
  2023-12-17 22:16 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-17 22:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Created attachment 56894
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56894&action=edit
Draft patch

Untested patch.

Needs regtesting and documentation update.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-12-17 22:16 ` anlauf at gcc dot gnu.org
@ 2023-12-17 22:16 ` anlauf at gcc dot gnu.org
  2023-12-18 18:17 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-17 22:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, wrong-code
             Status|WAITING                     |ASSIGNED

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-12-17 22:16 ` anlauf at gcc dot gnu.org
@ 2023-12-18 18:17 ` anlauf at gcc dot gnu.org
  2023-12-18 19:33 ` cvs-commit at gcc dot gnu.org
  2023-12-18 21:35 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-18 18:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-December/060045.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-12-18 18:17 ` anlauf at gcc dot gnu.org
@ 2023-12-18 19:33 ` cvs-commit at gcc dot gnu.org
  2023-12-18 21:35 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-18 19:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:b77691a90fc8a7e917417ce747bf78669304f951

commit r14-6665-gb77691a90fc8a7e917417ce747bf78669304f951
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Dec 18 18:59:02 2023 +0100

    Fortran: update DATE_AND_TIME intrinsic for Fortran 2018 [PR96580]

    Fortran 2018 allows a non-default integer kind for its VALUES argument if
    it has a decimal exponent range of at least four.  Update checks, library
    implementation and documentation.

    gcc/fortran/ChangeLog:

            PR fortran/96580
            * check.cc (array_size_check): New helper function.
            (gfc_check_date_and_time): Use it for checking minimum size of
            VALUES argument.  Update kind check to Fortran 2018.
            * intrinsic.texi: Fix documentation of DATE_AND_TIME.

    libgfortran/ChangeLog:

            PR fortran/96580
            * intrinsics/date_and_time.c (date_and_time): Handle VALUES
argument
            for kind=2 and kind=16 (if available).

    gcc/testsuite/ChangeLog:

            PR fortran/96580
            * gfortran.dg/date_and_time_2.f90: New test.
            * gfortran.dg/date_and_time_3.f90: New test.
            * gfortran.dg/date_and_time_4.f90: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/96580] F2018 changes to date_and_time intrinsics
  2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-12-18 19:33 ` cvs-commit at gcc dot gnu.org
@ 2023-12-18 21:35 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-18 21:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed in gcc-14.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-18 21:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12  6:53 [Bug fortran/96580] New: F2018 changes to date_and_time intrinsics markeggleston at gcc dot gnu.org
2021-02-22  5:42 ` [Bug fortran/96580] " jvdelisle at gcc dot gnu.org
2021-02-22 16:14 ` dominiq at lps dot ens.fr
2023-12-17 22:16 ` anlauf at gcc dot gnu.org
2023-12-17 22:16 ` anlauf at gcc dot gnu.org
2023-12-18 18:17 ` anlauf at gcc dot gnu.org
2023-12-18 19:33 ` cvs-commit at gcc dot gnu.org
2023-12-18 21:35 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).