https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98577
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Jan 07, 2021 at 06:49:07PM +0000, mehdi.chinoune at hotmail dot com wrote: > > I am not asking for advice here, I reported a bug with its reproducer. What bug? > It is not your concern what kind of integer I choose to use since it is not > invalid. Sure, you can use any integer kind. What you get back is processor-dependent. The gfortran documentation tells you what that dependence is. > The standard doesn't say anything about mixing precisions. I agree. It says the values returned for COUNT and COUNT_RATE are processor-dependent. If COUNT is integer(4), the counting is done in units of milliseconds. If COUNT is integer(kind>4), the counting is done in units of nanoseconds. If COUNT_RATE is integer(4) or real(4), it will be set to 1000, because that's how many milliseconds are in 1 second. If COUNT_RATE is integer(kind>4) or real(kind>4), it will be set to 1000000000, because that's how many nanoseconds are in 1 second. These are processor-dependent values chosen by gfortran. > I didn't say that gfortran should report 1000 or 10000 or 14659827, I know It > is a processor-dependent. > The problem is that gfortran doesn't give the correct values for > count/count_rate when it is int64/int32 or int64/real32 which doesn't have any > basis in the standard. You did not define what you mean by "correct value". If you meant int64/int32 is supposed to be elapsed time in units of seconds, I cannot find where the Standard states that. For a processor that has more than one count_rate, in the following, integer i,j call system_clock(count=i) call some_long_time_sub call system_clock(count=j) print *, j - i end how is the processor suppose to determine which count_rate units should be used to do the counting? It is the programmer's responsibility to read the documentation provided with the processor to determine the processor-dependent behavior, and then write code based on that documentation. It seems you have an issue with J3. Perhaps, you need to send an interpretation request to the Fortran Standard committee.