ThomasMertes / seed7

Source code of Seed7
GNU General Public License v2.0
207 stars 11 forks source link

"chk_all" fails on the "chktime" test #20

Closed celtic-coder closed 10 months ago

celtic-coder commented 10 months ago

Hi Thomas (@ThomasMertes),

Yesterday, I downloaded and installed the "seed7_05_20230913" version of Seed7 into the "C:\seed7" folder. I deleted the "C:\seed7" folder before completing the installation.

When I ran "chk_all", it produced the following output:

C:\seed7\prg>s7 chk_all.sd7
SEED7 INTERPRETER Version 5.2.10  Copyright (c) 1990-2023 Thomas Mertes
compiling the compiler - okay
chkint ........... okay
chkovf ........... okay
chkflt ........... okay
chkbin ........... okay
chkchr ........... okay
chkstr ........... okay
chkidx ........... okay
chkbst ........... okay
chkarr ........... okay
chkprc ........... okay
chkbig ........... okay
chkbool ........... okay
chkenum ........... okay
chktime
 *** The interpreted chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised with
{integer: <SYMBOLOBJECT> *NULL_ENTITY_OBJECT* year month day hour minute second micro_second timeZone TRUE FROM_TIMESTAMP }

Stack:
in FROM_TIMESTAMP (val integer: timestamp, inout integer: year, inout integer: month, inout integer: day, inout integer: hour, inout integer: minute, inout integer: second, inout integer: micro_second, inout integer: timeZone, inout boolean: daylightSavingTime) at /c/seed7/lib/time.s7i(65)
in timestamp1970ToTime (val integer: timestamp) at /c/seed7/lib/time.s7i(968)
in checkTimestamp1970 at chktime.sd7(1100)
in main at chktime.sd7(1844)

 *** The compiled chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised at tim_rtl.c(180)

.The error happened with the option

 *** The compiled chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised at tim_rtl.c(180)

.The error happened with the option -oc0

 *** The compiled chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised at tim_rtl.c(180)

.The error happened with the option -oc1

 *** The compiled chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised at tim_rtl.c(180)

.The error happened with the option -oc2

 *** The compiled chktime does not work okay:

The conversion of a string in ISO 8601 date format works correctly.
The conversion of a time to a string works correctly.
Leap year functions work correctly.

*** Uncaught exception RANGE_ERROR raised at tim_rtl.c(180)

.The error happened with the option -oc3

chkbitdata ........... okay
chkset ........... okay
chkhsh ........... okay
chkfil ........... okay
chkexc ........... okay

Might this problem have been corrected in the https://github.com/ThomasMertes/seed7/commit/4bae63e7584f1b56358279551bf51da7f605e609 commit, which was applied on September 17th, four days after the release?

For reference, here is the CMD console output of the installation:

seed7_05_20230709_win

``` C:\Users\New\Downloads>seed7_05_20230709_win Chkccomp uses NUL: as null device. Prepare compile command: .. done Check for link time optimization: . Not available. Numeric sizes: ........................ determined General settings: ........................................................................................ determined Numeric properties: .................................................................................................. determined Advanced settings: ................................................ determined Using Windows libraries MySql/MariaDb: db_my.h found in Seed7 include directory. MySql/MariaDb: DLL / Shared library: libmariadb.dll MySql/MariaDb: DLL / Shared library: libmysql.dll SQLite: db_lite.h found in Seed7 include directory. SQLite: DLL / Shared library: sqlite3.dll PostgreSQL: db_post.h found in Seed7 include directory. PostgreSQL: DLL / Shared library: libpq.dll PostgreSQL: DLL / Shared library: libintl.dll PostgreSQL: DLL / Shared library: libintl-8.dll PostgreSQL: DLL / Shared library: libintl-9.dll PostgreSQL: DLL / Shared library: libeay32.dll PostgreSQL: DLL / Shared library: libcrypto-1_1-x64.dll PostgreSQL: DLL / Shared library: libssl-1_1-x64.dll Odbc: sql.h found in system include directory. Odbc: Linker option: -lodbc32 Oracle: db_oci.h found in Seed7 include directory. Oracle: DLL / Shared library: oci.dll Firebird: db_fire.h found in Seed7 include directory. Firebird: DLL / Shared library: fbclient.dll Firebird: DLL / Shared library: gds32.dll DB2: db_odbc.h found in Seed7 include directory. DB2: DLL / Shared library: db2cli.dll Informix: sql.h found in system include directory. Informix: DLL / Shared library: iclit09b.dll SQL Server: sql.h found in system include directory. SQL Server: DLL / Shared library: sqlsrv32.dll TDS: db_tds.h found in Seed7 include directory. TDS: DLL / Shared library: sybdb.dll Macro read_buffer_empty defined. 10 times removing a file needed a reattempt. Current level is 10 ar: creating ..\bin\s7_comp.a ar: creating ..\bin\s7_data.a ar: creating ..\bin\s7_draw.a ar: creating ..\bin\s7_con.a ar: creating ..\bin\s7_db.a ar: creating ..\bin\seed7_05.a SEED7 INTERPRETER Version 5.2.10 Copyright (c) 1990-2023 Thomas Mertes Current level is 10 SEED7 INTERPRETER Version 5.2.10 Copyright (c) 1990-2023 Thomas Mertes Compiling the compiler ... SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/s7c Compiling the program ... Compiling the compiler ... Generating code ... after walk_const_list 6563 declarations processed 9438 optimizations done 22643 evaluations done 68 division checks inserted 148 range checks inserted 3540 index checks inserted 2195 overflow checks inserted Calling the C compiler ... c:\seed7\bin\call_gcc -w -O2 -ffunction-sections -fdata-sections -c tmp_s7c.c 2>tmp_s7c.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o s7c.exe tmp_s7c.o ..\bin\s7_comp.a ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\s7_db.a ..\bin\seed7_05.a -lws2_32 -lodbc32 -lgdi32 -lm 2>tmp_s7c.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/bas7.sd7 Compiling the program ... Generating code ... after walk_const_list 4319 declarations processed 4031 optimizations done 599 functions inlined 5869 evaluations done 19 division checks inserted 285 range checks inserted 1179 index checks inserted 33 index checks optimized away 1613 overflow checks inserted 129 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_bas7.c 2>tmp_bas7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o bas7.exe tmp_bas7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 -lgdi32 -lm 2>tmp_bas7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/bigfiles.sd7 Compiling the program ... Generating code ... after walk_const_list 1365 declarations processed 637 optimizations done 74 functions inlined 852 evaluations done 1 division checks inserted 39 range checks inserted 172 index checks inserted 2 index checks optimized away 242 overflow checks inserted 21 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_bigfiles.c 2>tmp_bigfiles.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o bigfiles.exe tmp_bigfiles.o ..\bin\s7_data.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 2>tmp_bigfiles.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/calc7.sd7 Compiling the program ... Generating code ... after walk_const_list 2758 declarations processed 1375 optimizations done 348 functions inlined 1926 evaluations done 1 division checks inserted 61 range checks inserted 536 index checks inserted 7 index checks optimized away 766 overflow checks inserted 34 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_calc7.c 2>tmp_calc7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o calc7.exe tmp_calc7.o ..\bin\s7_comp.a ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\s7_db.a ..\bin\seed7_05.a -lws2_32 -lodbc32 -lgdi32 -lm 2>tmp_calc7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/cat.sd7 Compiling the program ... Generating code ... after walk_const_list 657 declarations processed 231 optimizations done 46 functions inlined 300 evaluations done 1 division checks inserted 31 range checks inserted 104 index checks inserted 2 index checks optimized away 80 overflow checks inserted 7 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_cat.c 2>tmp_cat.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o cat.exe tmp_cat.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_cat.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/comanche.sd7 Compiling the program ... Generating code ... after walk_const_list 4308 declarations processed 4333 optimizations done 772 functions inlined 5256 evaluations done 3 division checks inserted 143 range checks inserted 1265 index checks inserted 306 index checks optimized away 1425 overflow checks inserted 277 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_comanche.c 2>tmp_comanche.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o comanche.exe tmp_comanche.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 -lm 2>tmp_comanche.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/db7.sd7 Compiling the program ... Generating code ... after walk_const_list 5661 declarations processed 4055 optimizations done 673 functions inlined 5813 evaluations done 32 division checks inserted 134 range checks inserted 1488 index checks inserted 127 index checks optimized away 2052 overflow checks inserted 286 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_db7.c 2>tmp_db7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o db7.exe tmp_db7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_db.a ..\bin\seed7_05.a -lws2_32 -lodbc32 -lgdi32 -lm 2>tmp_db7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/diff7.sd7 Compiling the program ... Generating code ... after walk_const_list 1138 declarations processed 685 optimizations done 65 functions inlined 885 evaluations done 1 division checks inserted 39 range checks inserted 172 index checks inserted 2 index checks optimized away 263 overflow checks inserted 22 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_diff7.c 2>tmp_diff7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o diff7.exe tmp_diff7.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_diff7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/find7.sd7 Compiling the program ... Generating code ... after walk_const_list 1270 declarations processed 635 optimizations done 66 functions inlined 859 evaluations done 1 division checks inserted 39 range checks inserted 163 index checks inserted 2 index checks optimized away 233 overflow checks inserted 22 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_find7.c 2>tmp_find7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o find7.exe tmp_find7.o ..\bin\s7_data.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 2>tmp_find7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/findchar.sd7 Compiling the program ... Generating code ... after walk_const_list 1271 declarations processed 646 optimizations done 66 functions inlined 868 evaluations done 1 division checks inserted 39 range checks inserted 164 index checks inserted 2 index checks optimized away 241 overflow checks inserted 23 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_findchar.c 2>tmp_findchar.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o findchar.exe tmp_findchar.o ..\bin\s7_data.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 2>tmp_findchar.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/ftp7.sd7 Compiling the program ... Generating code ... after walk_const_list 1876 declarations processed 1219 optimizations done 185 functions inlined 1568 evaluations done 1 division checks inserted 51 range checks inserted 280 index checks inserted 19 index checks optimized away 601 overflow checks inserted 69 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_ftp7.c 2>tmp_ftp7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o ftp7.exe tmp_ftp7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 -lgdi32 2>tmp_ftp7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/ftpserv.sd7 Compiling the program ... Generating code ... after walk_const_list 1653 declarations processed 1105 optimizations done 123 functions inlined 1490 evaluations done 1 division checks inserted 51 range checks inserted 218 index checks inserted 6 index checks optimized away 559 overflow checks inserted 66 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_ftpserv.c 2>tmp_ftpserv.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o ftpserv.exe tmp_ftpserv.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_ftpserv.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/hd.sd7 Compiling the program ... Generating code ... after walk_const_list 1130 declarations processed 617 optimizations done 65 functions inlined 840 evaluations done 1 division checks inserted 39 range checks inserted 157 index checks inserted 2 index checks optimized away 228 overflow checks inserted 21 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_hd.c 2>tmp_hd.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o hd.exe tmp_hd.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_hd.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/ide7.sd7 Compiling the program ... Generating code ... after walk_const_list 5348 declarations processed 3844 optimizations done 652 functions inlined 5622 evaluations done 32 division checks inserted 125 range checks inserted 1432 index checks inserted 127 index checks optimized away 1984 overflow checks inserted 281 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_ide7.c 2>tmp_ide7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o ide7.exe tmp_ide7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\seed7_05.a -lws2_32 -lgdi32 -lm 2>tmp_ide7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/make7.sd7 Compiling the program ... Generating code ... after walk_const_list 1750 declarations processed 1588 optimizations done 424 functions inlined 1783 evaluations done 1 division checks inserted 51 range checks inserted 616 index checks inserted 5 index checks optimized away 558 overflow checks inserted 31 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_make7.c 2>tmp_make7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o make7.exe tmp_make7.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_make7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/portfwd7.sd7 Compiling the program ... Generating code ... after walk_const_list 1233 declarations processed 701 optimizations done 53 functions inlined 1003 evaluations done 1 division checks inserted 31 range checks inserted 138 index checks inserted 2 index checks optimized away 472 overflow checks inserted 22 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_portfwd7.c 2>tmp_portfwd7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o portfwd7.exe tmp_portfwd7.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_portfwd7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/pv7.sd7 Compiling the program ... Generating code ... after walk_const_list 4562 declarations processed 3877 optimizations done 574 functions inlined 5262 evaluations done 47 division checks inserted 130 range checks inserted 1398 index checks inserted 201 index checks optimized away 2176 overflow checks inserted 270 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_pv7.c 2>tmp_pv7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o pv7.exe tmp_pv7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 -lgdi32 -lm 2>tmp_pv7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/sql7.sd7 Compiling the program ... Generating code ... after walk_const_list 1989 declarations processed 1176 optimizations done 140 functions inlined 1445 evaluations done 1 division checks inserted 48 range checks inserted 290 index checks inserted 4 index checks optimized away 608 overflow checks inserted 36 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_sql7.c 2>tmp_sql7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o sql7.exe tmp_sql7.o ..\bin\s7_data.a ..\bin\s7_draw.a ..\bin\s7_con.a ..\bin\s7_db.a ..\bin\seed7_05.a -lws2_32 -lodbc32 -lgdi32 -lm 2>tmp_sql7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/sydir7.sd7 Compiling the program ... Generating code ... after walk_const_list 1295 declarations processed 868 optimizations done 67 functions inlined 1226 evaluations done 1 division checks inserted 39 range checks inserted 161 index checks inserted 2 index checks optimized away 500 overflow checks inserted 26 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_sydir7.c 2>tmp_sydir7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o sydir7.exe tmp_sydir7.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_sydir7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/tar7.sd7 Compiling the program ... Generating code ... after walk_const_list 3813 declarations processed 2433 optimizations done 312 functions inlined 3069 evaluations done 3 division checks inserted 107 range checks inserted 698 index checks inserted 75 index checks optimized away 1147 overflow checks inserted 172 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_tar7.c 2>tmp_tar7.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o tar7.exe tmp_tar7.o ..\bin\s7_data.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 -lm 2>tmp_tar7.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/toutf8.sd7 Compiling the program ... Generating code ... after walk_const_list 1315 declarations processed 910 optimizations done 103 functions inlined 1113 evaluations done 1 division checks inserted 51 range checks inserted 200 index checks inserted 2 index checks optimized away 271 overflow checks inserted 61 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_toutf8.c 2>tmp_toutf8.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o toutf8.exe tmp_toutf8.o ..\bin\s7_data.a ..\bin\s7_con.a ..\bin\seed7_05.a -lws2_32 2>tmp_toutf8.lerrs >NUL: SEED7 COMPILER Version 3.2.10 Copyright (c) 1990-2023 Thomas Mertes Source: ../prg/which.sd7 Compiling the program ... Generating code ... after walk_const_list 1920 declarations processed 1007 optimizations done 282 functions inlined 1486 evaluations done 1 division checks inserted 45 range checks inserted 430 index checks inserted 5 index checks optimized away 426 overflow checks inserted 21 overflow checks optimized away Calling the C compiler ... c:\seed7\bin\call_gcc -w -O3 -ffunction-sections -fdata-sections -c tmp_which.c 2>tmp_which.cerrs >NUL: Calling the linker ... c:\seed7\bin\call_gcc -Wl","--strip-debug -Wl","--stack","8388608 -Wl","--gc-sections -o which.exe tmp_which.o ..\bin\s7_data.a ..\bin\seed7_05.a -lws2_32 2>tmp_which.lerrs >NUL: .\setwpath.exe add ..\bin C:\Users\New\Downloads> ```

Kind Regards, Liam

ThomasMertes commented 10 months ago

Hi Liam,

Thank you very much for your bug report.

The Seed7 function call stack: checkTimestamp1970 -> timestamp1970ToTime -> FROM_TIMESTAMP continues with C functions: timFromIntTimestamp -> timFromTimestamp -> localtime_s

Under windows the functions localtime() and localtime_s() do not accept negative timestamps. This contrasts to any reasonable operating system. :-(

The behavior of localtime() is already checked by chkccomp.c. Under Windows the file version.h contains the line:

#define LOCALTIME_WORKS_SIGNED 0

Unfortunately timFromTimestamp() does not consider LOCALTIME_WORKS_SIGNED.

My fix is: I have changed timFromIntTimestamp() to call timUtcFromTimestamp() and timSetLocalTZ(). Afterwards the the time is adjusted such that it corresponds to the timestamp in local time.

The function timSetLocalTZ() uses also localtime() to determine the time zone. The function timSetLocalTZ() considers LOCALTIME_WORKS_SIGNED. That way localtime()is never called with a negative timestamp under Windows. Instead of a negative timestamp the timestamp 0 is used to determine the timezone.

I have checked in the fix already.

celtic-coder commented 10 months ago

Closing this issue as resolved in https://github.com/ThomasMertes/seed7/commit/e7c3b2a208c86ea1e042bc439ec4db72f3f32b20.