* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
@ 2006-07-25 20:22 ` kargl at gcc dot gnu dot org
2006-09-03 6:10 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-07-25 20:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kargl at gcc dot gnu dot org 2006-07-25 20:22 -------
gfortran is primarily a Fortran 95 with a few Fortran 2003 enhancements.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu dot org
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
2006-07-25 20:22 ` [Bug fortran/28484] " kargl at gcc dot gnu dot org
@ 2006-09-03 6:10 ` pinskia at gcc dot gnu dot org
2006-10-28 16:39 ` patchapp at dberlin dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-03 6:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-09-03 06:10 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |20585
nThis| |
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-09-03 06:10:52
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
2006-07-25 20:22 ` [Bug fortran/28484] " kargl at gcc dot gnu dot org
2006-09-03 6:10 ` pinskia at gcc dot gnu dot org
@ 2006-10-28 16:39 ` patchapp at dberlin dot org
2006-10-28 22:13 ` burnus at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: patchapp at dberlin dot org @ 2006-10-28 16:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from patchapp at dberlin dot org 2006-10-28 16:39 -------
Subject: Bug number PR28484
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01387.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (2 preceding siblings ...)
2006-10-28 16:39 ` patchapp at dberlin dot org
@ 2006-10-28 22:13 ` burnus at gcc dot gnu dot org
2006-11-02 16:02 ` burnus at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-10-28 22:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2006-10-28 22:13 -------
Assign.
Preliminary patch at:
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01387.html
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |burnus at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-09-03 06:10:52 |2006-10-28 22:13:07
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (3 preceding siblings ...)
2006-10-28 22:13 ` burnus at gcc dot gnu dot org
@ 2006-11-02 16:02 ` burnus at gcc dot gnu dot org
2006-11-02 16:32 ` burnus at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-02 16:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2006-11-02 16:02 -------
Created an attachment (id=12535)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12535&action=view)
Idea how libgfortran/intrinsic/system_clock.c could look like
Some bits of thought.
Methods obtaining the time:
* clock_gettime() [POSIX]
10^-9s (nanosecond) resolution, options:
CLOCK_REALTIME - on unix time since the epoch [I would suggested this]
CLOCK_MONOTONIC - survives even changing the time,
but starting point is arbitrary
See also PR 15516 for assembler calling sequences for Linux
* gettimeofday (&tv, NULL) [POSIX]
10^-6s (microsecond) resolution
* time() [POSIX]
second resolution
Resolution -> time able to be represented
---------------------------------------------
For huge(i4) = 2147483647
1000 ms: 68 years
100 ms: 2485 days
10 ms: 246 days
1 ms: 25 days
100 us: 60 hours
10 us: 6 hours
=> 10 ms seems to be a good resolution, 25 days might be a bit short for some
calculation jobs, but 250 days should be enough.
For huge(i8) = 9223372036854775807
1 s: 2e11 years
1 ms: 2e8 years
1 us: 292271 years
1 ns: 292 years
=> 1 ns seems to be ok
I'm thinking of the following library implementation:
Only do integer(8) as this seems to be enough. (See attachment.)
For iresolve.c one needs to do something like the following (pseudo code):
if(count != NULL && counts.type != 8)
gfc_convert_type()
if(count != NULL && count_max.type != 8)
gfc_convert_type()
if(count != NULL && count_rate.type != 8)
gfc_convert_type()
c->resolved_sym = gfc_get_intrinsic_sub_symbol ("system_clock")
if (count != NULL && count.type == 4)
count = (int4) ((count8/10000000) % GFC_INTEGER_4_HUGE)
else if (count != NULL && count.type != 8)
count = (type) count8
if (count_rate != NULL && count_rate.type == 4)
add_expression("if(count_rate8 == 0) count_rate = 0"
"else count_rate = 100")
else if (count != NULL && count.type != 8)
count_rate = (type) count_rate8
if (count_max != NULL && count_max.type == 4)
add_expression("if(count_max8 == 0) count_max = 0"
"else count_max = GFC_INTEGER_4_HUGE")
else if (count != NULL && count.type != 8)
count_rate = (type) count_rate8
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (4 preceding siblings ...)
2006-11-02 16:02 ` burnus at gcc dot gnu dot org
@ 2006-11-02 16:32 ` burnus at gcc dot gnu dot org
2007-05-22 15:16 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-02 16:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from burnus at gcc dot gnu dot org 2006-11-02 16:32 -------
Created an attachment (id=12536)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12536&action=view)
Revised idea how libgfortran/intrinsic/system_clock.c could look like
The latter part is of cause not completely right if count_rate = 1 or 1000000,
and for an error int16 and real counts didn't contain -huge().
Maybe having in the library a system_clock_4 version makes life easier.
The following pseudocode should then work with system_clock_4 and
system_clock_8 (which has also the advantage that we don't modify the library
which is nice in terms of compatibility :-)
if ( (counts != NULL && counts.type == 4)
||(count_max != NULL && count_max.type == 4) {
if(count != NULL && counts.type != 4)
gfc_convert_type()
if(count != NULL && count_max.type != 4)
gfc_convert_type()
if(count != NULL && count_rate.type != 4)
gfc_convert_type()
c->resolved_sym = gfc_get_intrinsic_sub_symbol ("system_clock_4")
if (counts != NULL && counts.type != 4)
add_expression("if(counts4 < 0) counts = -huge_max(type)"
"else counts = (type) counts4")
if (count_rate != NULL && count_rate.type != 4)
count_rate = (type) count_rate4
if (count_max != NULL && count_max.type != 4)
count_rate = (type) count_rate4
} else {
if(count != NULL && counts.type != 8)
gfc_convert_type()
if(count != NULL && count_max.type != 8)
gfc_convert_type()
if(count != NULL && count_rate.type != 8)
gfc_convert_type()
c->resolved_sym = gfc_get_intrinsic_sub_symbol ("system_clock_8")
if (counts != NULL && counts.type != 8)
add_expression("if(counts8 < 0) counts = -huge_max(type)"
"else counts = (type) counts8")
if (count_rate != NULL && count_rate.type != 8)
count_rate = (type) count_rate8
if (count_max != NULL && count_max.type != 8)
count_rate = (type) count_rate8
}
Now I only have to figure out how to add the conversion and the "if(counts8 <
0)" expression in iresolve.c.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #12535|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (5 preceding siblings ...)
2006-11-02 16:32 ` burnus at gcc dot gnu dot org
@ 2007-05-22 15:16 ` burnus at gcc dot gnu dot org
2007-05-22 15:18 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-22 15:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from burnus at gcc dot gnu dot org 2007-05-22 16:16 -------
Won't work on it for a while.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2006-10-28 22:13:07 |2007-05-22 16:16:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (6 preceding siblings ...)
2007-05-22 15:16 ` burnus at gcc dot gnu dot org
@ 2007-05-22 15:18 ` burnus at gcc dot gnu dot org
2007-05-29 20:44 ` dfranke at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-22 15:18 UTC (permalink / raw)
To: gcc-bugs
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|burnus at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (7 preceding siblings ...)
2007-05-22 15:18 ` burnus at gcc dot gnu dot org
@ 2007-05-29 20:44 ` dfranke at gcc dot gnu dot org
2007-10-26 7:32 ` jv244 at cam dot ac dot uk
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-29 20:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from dfranke at gcc dot gnu dot org 2007-05-29 20:44 -------
Taking over.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dfranke at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-05-22 16:16:25 |2007-05-29 20:44:46
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (8 preceding siblings ...)
2007-05-29 20:44 ` dfranke at gcc dot gnu dot org
@ 2007-10-26 7:32 ` jv244 at cam dot ac dot uk
2007-12-13 19:14 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-10-26 7:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jv244 at cam dot ac dot uk 2007-10-26 07:32 -------
(In reply to comment #8)
> Taking over.
>
Any news on this ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (9 preceding siblings ...)
2007-10-26 7:32 ` jv244 at cam dot ac dot uk
@ 2007-12-13 19:14 ` dfranke at gcc dot gnu dot org
2009-04-11 21:36 ` [Bug fortran/28484] F2003: " jvdelisle at gcc dot gnu dot org
2009-12-19 10:50 ` jb at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-12-13 19:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from dfranke at gcc dot gnu dot org 2007-12-13 19:14 -------
(In reply to comment #9)
> Any news on this ?
Bad ones. Lost track due to real-life interference.
Unassigning myself for now.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|dfranke at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] F2003: system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (10 preceding siblings ...)
2007-12-13 19:14 ` dfranke at gcc dot gnu dot org
@ 2009-04-11 21:36 ` jvdelisle at gcc dot gnu dot org
2009-12-19 10:50 ` jb at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-04-11 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jvdelisle at gcc dot gnu dot org 2009-04-11 21:35 -------
Raising this up a little since F2003 features are coming up
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
Summary|system_clock with real-type |F2003: system_clock with
|count_rate does not compile |real-type count_rate does
| |not compile
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/28484] F2003: system_clock with real-type count_rate does not compile
2006-07-25 17:09 [Bug fortran/28484] New: system_clock with real-type count_rate does not compile tobias dot burnus at physik dot fu-berlin dot de
` (11 preceding siblings ...)
2009-04-11 21:36 ` [Bug fortran/28484] F2003: " jvdelisle at gcc dot gnu dot org
@ 2009-12-19 10:50 ` jb at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-19 10:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jb at gcc dot gnu dot org 2009-12-19 10:50 -------
Since the actual implementation of system_clock has no use for non-integer
count rates, this should be implemented by creating an integer temporary in the
frontend and then calling the existing functions.
Also, note that as of r155359 the integer(8) version of system_clock now
provides microsecond resolution. In the future, this could be improved further
by switching to using clock_gettime(CLOCK_MONOTONIC,...) which in addition to
providing better resolution also gives a monotonic clock instead of a realtime
clock that gettimeofday() gives.
--
jb at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jb at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484
^ permalink raw reply [flat|nested] 14+ messages in thread