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 ()

Reply via email to