[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2023-12-18 Thread anlauf at gcc dot gnu.org via 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.

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2023-12-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Harald Anlauf :

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

commit r14-6665-gb77691a90fc8a7e917417ce747bf78669304f951
Author: Harald Anlauf 
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.

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2023-12-18 Thread anlauf at gcc dot gnu.org via 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

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2023-12-17 Thread anlauf at gcc dot gnu.org via 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

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2023-12-17 Thread anlauf at gcc dot gnu.org via 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=edit
Draft patch

Untested patch.

Needs regtesting and documentation update.

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2021-02-22 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

Dominique d'Humieres  changed:

   What|Removed |Added

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

--- Comment #2 from Dominique d'Humieres  ---
AFAICT the testing comment 2 works with integer(2) replaced with integer(4) or
integer(8), but not with integer(16).

[Bug fortran/96580] F2018 changes to date_and_time intrinsics

2021-02-21 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96580

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #1 from Jerry DeLisle  ---
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.
0x00443585 in raise ()
(gdb) bt
#0  0x00443585 in raise ()
#1  0x004012cb in abort ()
#2  0x0040110a in _gfortran_date_and_time (__date=, 
__time=, __zone=, __values=, 
__date_len=, __time_len=, __zone_len=5)
at ../../../trunk/libgfortran/intrinsics/date_and_time.c:227
#3  0x00402267 in test_time_and_date () at pr96580.f90:7
#4  0x004025ba in main (argc=1, argv=0x7fffd9c6) at pr96580.f90:14
#5  0x0043cf6a in __libc_start_main ()
#6  0x004020be in _start ()