This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Implementation SYSTEM_CLOCK intrinsic subroutine


On Fri, May 14, 2004 at 05:34:03PM +0100, Paul Brook wrote:
> On Friday 14 May 2004 17:26, Steve Kargl wrote:
> > On Fri, May 14, 2004 at 01:34:19PM +0200, Tobias Schl?ter wrote:
> > > Steve Kargl wrote:
> > > >   program a          ! system_clock requires at least 1 of its
> > > >   call system_clock  ! optional arguments to be present.
> > > >   end program a
> > >
> > > I don't see that this is true. The standard says that each of these
> > > arguments are optional, and there is no constraint that one be present,
> > > as in the case of SELECTED_REAL_KIND for instance. Of course the call
> > > doesn't make much sense if no arguments are given.
> >
> > Yikes.  You are right.  The standard does not mandate that
> > one of the optional arguments is required.  In fact, NAG's
> > compiler will compile the above without a problem, and the
> > executable runs.  I think I'll need to update the resolving
> > routine and if no arguments are present, then point at a
> > __system_clock_nop internal routine.
> 
> Why bother? The existing routine should do the right thing (ie nothing).
> 

I don't understand what you mean by "existing routine".  Without my
patch the above code gives

troutmask:sgk[204] gfortran -static -o d d.f90
/usr/home/sgk/tmp/cc1NVVxe.o: In function `MAIN__':
/usr/home/sgk/tmp/cc1NVVxe.o(.text+0x10): undefined reference to `_gfortran_syst
em_clock'
collect2: ld returned 1 exit status


With my patch I get

troutmask:sgk[207] gfortran -static -o d d.f90
d.f90:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

troutmask:sgk[227] gdb6 ~/libexec/gcc/i386-unknown-freebsd5.2/3.5.0/f951
GNU gdb 20040413 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-portbld-freebsd5.2"...
(gdb) run d.f90
Starting program: /usr/home/sgk/libexec/gcc/i386-unknown-freebsd5.2/3.5.0/f951 d.f90

Program received signal SIGSEGV, Segmentation fault.
gfc_resolve_system_clock (c=0x84d7200) at ../../gcc/gcc/fortran/iresolve.c:1385
1385          name = gfc_get_string (PREFIX("system_clock_%d"), kind);

Clearly, the else clause in gfc_resolve_system_clock needs some attention.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]