Hi, all
There have been some recent improvements to the Mersenne Twister (the random number generator that is used in the GPC unit), and I've been translating them into Pascal for eventual submission to the programming team. As part of this, I wanted to check the execution time, so I wrote a timer (I thought!) into a test program:
program testMT; uses GPC, MTrand; {MTrand is the name of the unit I'm working on} const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin SeedRand(1234567890); GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
The compiler hangs with the following error: testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report
I'm guessing that it's not about my unit, but rather what I'm trying to do with capturing a string into an int... anyway, here is a bug report.
Toby
On Fri, 27 Feb 2004, Toby Ewing wrote:
Hi, all
There have been some recent improvements to the Mersenne Twister (the random number generator that is used in the GPC unit), and I've been translating them into Pascal for eventual submission to the programming team. As part of this, I wanted to check the execution time, so I wrote a timer (I thought!) into a test program:
program testMT; uses GPC, MTrand; {MTrand is the name of the unit I'm working on} const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin SeedRand(1234567890); GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
First, use writeln instead of writestr.
Second, if you use only the 'Q' part of unixtime you might start near the end of a second and get a roll over, thus giving you a negative number for elapsed time
Try this:
program timeMT; uses GPC; const big = 10000000; var i, j : medCard; CurrentTime, CurrentTime2 : longint;
begin Currenttime := GetMicrosecondTime; writeln( Currenttime ); {you really don't need this line}
for i := 1 to big do j := 2*2*2; {dummy line to get some elapsed time}
Currenttime2 := GetMicrosecondtime; writeln( Currenttime2 ); {you don't need this line, either} Writeln('Elapsed time: ', (Currenttime2 - Currenttime)); end.
Russ
Toby Ewing wrote:
There have been some recent improvements to the Mersenne Twister (the random number generator that is used in the GPC unit), and I've been translating them into Pascal for eventual submission to the programming team. As part of this, I wanted to check the execution time, so I wrote a timer (I thought!) into a test program:
program testMT; uses GPC, MTrand; {MTrand is the name of the unit I'm working on} const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin SeedRand(1234567890); GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
The compiler hangs with the following error: testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report
I'm guessing that it's not about my unit, but rather what I'm trying to do with capturing a string into an int... anyway, here is a bug report.
I can't reproduce the problem, but I don't know if it's because I might have fixed already (with other changes in the meantime) or because I don't have your unit. Does the following program without the unit also exhibit the problem? Otherwise, could you please send a program to reproduce it?
program testMT; uses GPC; const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } { WRONG } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
Frank
Hi, all
Frank Heckenbach wrote:
Toby Ewing wrote:
program testMT; uses GPC, MTrand; {MTrand is the name of the unit I'm working on} const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin SeedRand(1234567890); GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
The compiler hangs with the following error: testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report
I can't reproduce the problem, but I don't know if it's because I might have fixed already (with other changes in the meantime) or because I don't have your unit. Does the following program without the unit also exhibit the problem? Otherwise, could you please send a program to reproduce it?
program testMT; uses GPC; const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp; begin GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } { WRONG } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
I compiled the above code, and got the same error: frank.pas: In main program: frank.pas:12: reference expected, value given frank.pas:12: reference expected, value given frank.pas:12: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions.
If more recent versions of gpc have fixed this, please tell me! I'm currently running version 20030507, based on gcc-3.2.2
Toby
Toby Ewing wrote:
I compiled the above code, and got the same error: frank.pas: In main program: frank.pas:12: reference expected, value given frank.pas:12: reference expected, value given frank.pas:12: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions.
If more recent versions of gpc have fixed this, please tell me! I'm currently running version 20030507, based on gcc-3.2.2
You might try 20030830, but it might also be a change I made afterwards. Since this bug doesn't seem too important, you might just want to wait for the next time you upgrade anyway, and then recheck it if you like, but I suppose it's fixed then. (toby2.pas, just to be sure.)
Frank
On 3 Mar 2004 at 17:16, Toby Ewing wrote: [....]
If more recent versions of gpc have fixed this, please tell me! I'm currently running version 20030507, based on gcc-3.2.2
Check here: http://www.gnu-pascal.de/contrib/chief/win32/mingw32/
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Toby Ewing wrote:
I compiled the above code, and got the same error: frank.pas: In main program: frank.pas:12: reference expected, value given frank.pas:12: reference expected, value given frank.pas:12: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions.
If more recent versions of gpc have fixed this, please tell me! I'm currently running version 20030507, based on gcc-3.2.2
Actually I can reproduce the problem now (I did something wrong the other day). Here's a fix. (But it's not serious anyway. ;-)
Frank
On Wed, 3 Mar 2004, Frank Heckenbach wrote:
[..]
program testMT; uses GPC; const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } { WRONG } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
If I change the first writestr like so:
var s : string[30]; ... s := FormatTime(CurrentTime, TimeFormat); writestr( s, t1 ); ...
Two of the original errors went away:
frank.pas: In main program: frank.pas:14: error: undeclared identifier `randInt' (first use in this routine) frank.pas:14: error: (Each undeclared identifier is reported only once frank.pas:14: error: for each routine it appears in.) frank.pas:16: error: reference expected, value given frank.pas:16: error: reference expected, value given
Is line 16 a bug? And where would I find 'randInt' ?
Russ
Russell Whitaker wrote:
On Wed, 3 Mar 2004, Frank Heckenbach wrote:
[..]
program testMT; uses GPC; const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } { WRONG } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
If I change the first writestr like so:
var s : string[30]; ... s := FormatTime(CurrentTime, TimeFormat); writestr( s, t1 ); ...
Two of the original errors went away:
Yes, but it doesn't do what was intended.
frank.pas: In main program: frank.pas:14: error: undeclared identifier `randInt' (first use in this routine) frank.pas:14: error: (Each undeclared identifier is reported only once frank.pas:14: error: for each routine it appears in.) frank.pas:16: error: reference expected, value given frank.pas:16: error: reference expected, value given
Is line 16 a bug?
No, it's correct. The first parameter of `WriteStr' cannot be a value because it's written to.
And where would I find 'randInt' ?
I suppose it's in the unit the OP was developing, so you'd have to take it out here.
Emil Jerabek wrote:
Do I understand it correctly that the "reference expected etc." messages are OK, and the only question is about the "tree check" failure?
Yes.
If so, the error seems to be already fixed in gpc 20030830.
Thanks for checking.
Frank
Frank Heckenbach wrote:
Russell Whitaker wrote:
On Wed, 3 Mar 2004, Frank Heckenbach wrote:
[..] And where would I find 'randInt' ?
I suppose it's in the unit the OP was developing, so you'd have to take it out here.
Correct (but what's an "OP"?). I'll send along the new rand unit in a day or two. Some nice new routines. There is essentially no speedup, though, despite such claims about the original unreadable "optimized" C++ code.
Emil Jerabek wrote:
If so, the error seems to be already fixed in gpc 20030830.
Thanks for checking.
Excellent, thank you. I think it's worth upgrading again.
Way way back to an earlier issue: does anyone know of a windows utility equivalent to unix's "time"? I've found nothing that gives a processes' CPU time (usage), only clock time (duration).
Toby
On 4 Mar 2004 at 11:37, Toby Ewing wrote:
[....]
Way way back to an earlier issue: does anyone know of a windows utility equivalent to unix's "time"? I've found nothing that gives a processes' CPU time (usage), only clock time (duration).
Both the Cygwin and MSYS systems have a "time" command.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
On Wed, Mar 03, 2004 at 02:13:42PM +0100, Frank Heckenbach wrote:
Toby Ewing wrote:
[...]
The compiler hangs with the following error: testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: reference expected, value given testmt.pas(17): Error: tree check: expected class 't', have 'x' (error_mark) in require_complete_type, at p/typecheck.c:63 Please submit a full bug report
I'm guessing that it's not about my unit, but rather what I'm trying to do with capturing a string into an int... anyway, here is a bug report.
I can't reproduce the problem, but I don't know if it's because I might have fixed already (with other changes in the meantime) or because I don't have your unit. Does the following program without the unit also exhibit the problem? Otherwise, could you please send a program to reproduce it?
program testMT; uses GPC; const big = 10000000; TimeFormat = ' %Q'; var t1, t2, i, j : medCard; CurrentTime : TimeStamp;
begin GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t1); { line 17 } { WRONG } for i := 1 to big do j := randInt; GetTimeStamp (CurrentTime); WriteStr(FormatTime(CurrentTime, TimeFormat), t2); Writeln('Elapsed time: ', (t2 - t1):1); end.
Do I understand it correctly that the "reference expected etc." messages are OK, and the only question is about the "tree check" failure?
If so, the error seems to be already fixed in gpc 20030830.
[~/pas]% gpc -v Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs Configured with: ../gcc-3.3.2/configure --enable-languages=pascal --disable-nls : (reconfigured) ../gcc-3.3.2/configure --enable-languages=pascal --disable-nls Thread model: posix gpc version 20030830, based on gcc-3.3.2 [~/pas]% gpc --automake tst.pas tst.pas: In main program: tst.pas:12: error: reference expected, value given tst.pas:12: error: reference expected, value given tst.pas:13: error: undeclared identifier `randInt' (first use in this routine) tst.pas:13: error: (Each undeclared identifier is reported only once tst.pas:13: error: for each routine it appears in.) tst.pas:15: error: reference expected, value given tst.pas:15: error: reference expected, value given
Emil