Discussion:
[Simh] MINGW warning with recent sim_console.c checkin
Veit, Holger
2018-04-15 19:35:52 UTC
Permalink
Hi,
the recent debugging changes in sim_console.c trigger a warning in MINGW build:

C:\simh\simh-master\build_mingw.bat
lib paths are: C:/MinGW/lib
include paths are: C:/MinGW/include
using libpcreposix: c:/simh/windows-build/PCRE/lib/pcreposix.a c:/simh/windows-build/PCRE/include/pcreposix.h
***
*** all Simulators being built with:
*** - compiler optimizations and no debugging support. GCC Version: GCC-6.3.0-1).
*** - dynamic networking support using windows-build provided libpcap components.
*** - Local LAN packet transports: PCAP NAT(SLiRP)
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
***
*** git commit id is afffe300ee64df6a1a5c88c6e0eb50fc8f442c31.
*** git commit time is 2018-04-13T13:42:30-07:00.
***
*** No SDL ttf support available. BESM-6 video panel disabled.
***
*** Info *** Install the development components of libSDL-ttf packaged by your
*** Info *** operating system distribution and rebuild your simulator to
*** Info *** enable this extra functionality.
gcc -std=gnu99 -U__STRICT_ANSI__ -O2 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -Wno-unused-result -DSIM_GIT_COMMIT_ID=afffe300ee64df6a1a5c88c6e0eb50fc8f442c31 -DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -DHAVE_NTDDDISK_H -DSIM_COMPILER="GCC Version: GCC-6.3.0-1)" -I . -fms-extensions -DUSE_READER_THREAD -DPTW32_STATIC_LIB -D_POSIX_C_SOURCE -I../windows-build/pthreads/Pre-built.2/include -DSIM_ASYNCH_IO -DHAVE_PCREPOSIX_H -DPCRE_STATIC -Ic:/simh/windows-build/PCRE/include SAGE.new/sage_cpu.c SAGE.new/sage_sys.c SAGE.new/sage_stddev.c SAGE.new/sage_cons.c SAGE.new/sage_fd.c SAGE.new/sage_lp.c SAGE.new/m68k_cpu.c SAGE.new/m68k_mem.c SAGE.new/m68k_scp.c SAGE.new/m68k_parse.tab.c SAGE.new/m68k_sys.c SAGE.new/chip_io.c SAGE.new/i8251.c SAGE.new/i8253.c SAGE.new/i8255.c SAGE.new/i8259.c SAGE.new/i8272.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c sim_card.c -DCPU68000 -DUSE_CHIPIO -DHAVE_INT64 -DUSE_SIM_IMD -I SAGE.new -o BIN/sage.exe -lm -lwsock32 -lwinmm -lpthreadGC2 -L..\windows-build\pthreads\Pre-built.2\lib -lpcreposix -lpcre -L../windows-build/PCRE/lib/
sim_console.c: In Funktion »sim_set_debon«:
sim_console.c:2246:26: Warnung: Übergabe des Arguments 1 von »localtime« von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
loc_tm = *localtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
from sim_console.c:130:
c:\mingw\include\time.h:236:45: Anmerkung: »const time_t * {aka const long int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *localtime (const time_t *);
^~~~~~~~~
sim_console.c:2247:23: Warnung: Übergabe des Arguments 1 von »gmtime« von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
gmt_tm = *gmtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
from sim_console.c:130:
c:\mingw\include\time.h:235:45: Anmerkung: »const time_t * {aka const long int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *gmtime (const time_t *);
^~~~~~

----------------
The executable builds, but....
The problem comes from some compatibility with Windows MSCRT compatibility which defines struct timespec in <time.h> incompatibly as
struct timespec {
__time64_t tv_sec;
__int32 tv_nsec;
};

rather than
struct timespec {
time_t tv_sec;
time_t tv_nsec;
};

I wouldn't care about that if the pthreads library wouldn't also mess with timespec, so it is likely something broken here even if the executable is built.
My recommendation is to add (in sim_console.c:2243)
time_t temp = sim_deb_basetime.tv_sec;
and rewrite both localtime/gmtime function calls to use &temp instead.

Regards
Holger

--
Sent by Exchange 2013
Reply to ***@iais.fraunhofer.de
Veit, Holger
2018-04-15 19:41:15 UTC
Permalink
Fast followup. Make the proposed fix:

struct tm loc_tm, gmt_tm;
time_t temp;

clock_gettime(CLOCK_REALTIME, &sim_deb_basetime);
temp= sim_deb_basetime.tv_sec;

/* Adjust the relative timebase to reflect the localtime GMT offset */
loc_tm = *localtime (&temp);
gmt_tm = *gmtime (&temp);

--
Sent by Exchange 2013
Reply to ***@iais.fraunhofer.de


________________________________________
Von: Veit, Holger
Gesendet: Sonntag, 15. April 2018 21:35
An: ***@trailing-edge.com
Betreff: MINGW warning with recent sim_console.c checkin

Hi,
the recent debugging changes in sim_console.c trigger a warning in MINGW build:

C:\simh\simh-master\build_mingw.bat
lib paths are: C:/MinGW/lib
include paths are: C:/MinGW/include
using libpcreposix: c:/simh/windows-build/PCRE/lib/pcreposix.a c:/simh/windows-build/PCRE/include/pcreposix.h
***
*** all Simulators being built with:
*** - compiler optimizations and no debugging support. GCC Version: GCC-6.3.0-1).
*** - dynamic networking support using windows-build provided libpcap components.
*** - Local LAN packet transports: PCAP NAT(SLiRP)
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
***
*** git commit id is afffe300ee64df6a1a5c88c6e0eb50fc8f442c31.
*** git commit time is 2018-04-13T13:42:30-07:00.
***
*** No SDL ttf support available. BESM-6 video panel disabled.
***
*** Info *** Install the development components of libSDL-ttf packaged by your
*** Info *** operating system distribution and rebuild your simulator to
*** Info *** enable this extra functionality.
gcc -std=gnu99 -U__STRICT_ANSI__ -O2 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -Wno-unused-result -DSIM_GIT_COMMIT_ID=afffe300ee64df6a1a5c88c6e0eb50fc8f442c31 -DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -DHAVE_NTDDDISK_H -DSIM_COMPILER="GCC Version: GCC-6.3.0-1)" -I . -fms-extensions -DUSE_READER_THREAD -DPTW32_STATIC_LIB -D_POSIX_C_SOURCE -I../windows-build/pthreads/Pre-built.2/include -DSIM_ASYNCH_IO -DHAVE_PCREPOSIX_H -DPCRE_STATIC -Ic:/simh/windows-build/PCRE/include SAGE.new/sage_cpu.c SAGE.new/sage_sys.c SAGE.new/sage_stddev.c SAGE.new/sage_cons.c SAGE.new/sage_fd.c SAGE.new/sage_lp.c SAGE.new/m68k_cpu.c SAGE.new/m68k_mem.c SAGE.new/m68k_scp.c SAGE.new/m68k_parse.tab.c SAGE.new/m68k_sys.c SAGE.new/chip_io.c SAGE.new/i8251.c SAGE.new/i8253.c SAGE.new/i8255.c SAGE.new/i8259.c SAGE.new/i8272.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c sim_card.c -DCPU68000 -DUSE_CHIPIO -DHAVE_INT64 -DUSE_SIM_IMD -I SAGE.new -o BIN/sage.exe -lm -lwsock32 -lwinmm -lpthreadGC2 -L..\windows-build\pthreads\Pre-built.2\lib -lpcreposix -lpcre -L../windows-build/PCRE/lib/
sim_console.c: In Funktion »sim_set_debon«:
sim_console.c:2246:26: Warnung: Übergabe des Arguments 1 von »localtime« von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
loc_tm = *localtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
from sim_console.c:130:
c:\mingw\include\time.h:236:45: Anmerkung: »const time_t * {aka const long int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *localtime (const time_t *);
^~~~~~~~~
sim_console.c:2247:23: Warnung: Übergabe des Arguments 1 von »gmtime« von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
gmt_tm = *gmtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
from sim_console.c:130:
c:\mingw\include\time.h:235:45: Anmerkung: »const time_t * {aka const long int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *gmtime (const time_t *);
^~~~~~

----------------
The executable builds, but....
The problem comes from some compatibility with Windows MSCRT compatibility which defines struct timespec in <time.h> incompatibly as
struct timespec {
__time64_t tv_sec;
__int32 tv_nsec;
};

rather than
struct timespec {
time_t tv_sec;
time_t tv_nsec;
};

I wouldn't care about that if the pthreads library wouldn't also mess with timespec, so it is likely something broken here even if the executable is built.
My recommendation is to add (in sim_console.c:2243)
time_t temp = sim_deb_basetime.tv_sec;
and rewrite both localtime/gmtime function calls to use &temp instead.

Regards
Holger

--
Sent by Exchange 2013
Reply to ***@iais.fraunhofer.de
Mark Pizzolato
2018-04-15 19:55:19 UTC
Permalink
Post by Veit, Holger
struct tm loc_tm, gmt_tm;
time_t temp;
clock_gettime(CLOCK_REALTIME, &sim_deb_basetime);
temp= sim_deb_basetime.tv_sec;
/* Adjust the relative timebase to reflect the localtime GMT offset */
loc_tm = *localtime (&temp);
gmt_tm = *gmtime (&temp);
Fixed now, essentially like this.

Thanks.

- Mark
Post by Veit, Holger
Von: Veit, Holger
Gesendet: Sonntag, 15. April 2018 21:35
Betreff: MINGW warning with recent sim_console.c checkin
Hi,
C:\simh\simh-master\build_mingw.bat
lib paths are: C:/MinGW/lib
include paths are: C:/MinGW/include
using libpcreposix: c:/simh/windows-build/PCRE/lib/pcreposix.a
c:/simh/windows-build/PCRE/include/pcreposix.h
***
*** - compiler optimizations and no debugging support. GCC Version: GCC-
6.3.0-1).
*** - dynamic networking support using windows-build provided libpcap components.
*** - Local LAN packet transports: PCAP NAT(SLiRP)
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
***
*** git commit id is afffe300ee64df6a1a5c88c6e0eb50fc8f442c31.
*** git commit time is 2018-04-13T13:42:30-07:00.
***
*** No SDL ttf support available. BESM-6 video panel disabled.
***
*** Info *** Install the development components of libSDL-ttf packaged by your
*** Info *** operating system distribution and rebuild your simulator to
*** Info *** enable this extra functionality.
gcc -std=gnu99 -U__STRICT_ANSI__ -O2 -finline-functions -fgcse-after-reload -
fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-
strict-overflow -Wno-unused-result -
DSIM_GIT_COMMIT_ID=afffe300ee64df6a1a5c88c6e0eb50fc8f442c31 -
DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -
DSIM_GIT_COMMIT_TIME=2018-04-13T13:42:30-07:00 -DHAVE_NTDDDISK_H -
DSIM_COMPILER="GCC Version: GCC-6.3.0-1)" -I . -fms-extensions -
DUSE_READER_THREAD -DPTW32_STATIC_LIB -D_POSIX_C_SOURCE -
I../windows-build/pthreads/Pre-built.2/include -DSIM_ASYNCH_IO -
DHAVE_PCREPOSIX_H -DPCRE_STATIC -Ic:/simh/windows-build/PCRE/include
SAGE.new/sage_cpu.c SAGE.new/sage_sys.c SAGE.new/sage_stddev.c
SAGE.new/sage_cons.c SAGE.new/sage_fd.c SAGE.new/sage_lp.c
SAGE.new/m68k_cpu.c SAGE.new/m68k_mem.c SAGE.new/m68k_scp.c
SAGE.new/m68k_parse.tab.c SAGE.new/m68k_sys.c SAGE.new/chip_io.c
SAGE.new/i8251.c SAGE.new/i8253.c SAGE.new/i8255.c SAGE.new/i8259.c
SAGE.new/i8272.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c
sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c
sim_imd.c sim_card.c -DCPU68000 -DUSE_CHIPIO -DHAVE_INT64 -
DUSE_SIM_IMD -I SAGE.new -o BIN/sage.exe -lm -lwsock32 -lwinmm -
lpthreadGC2 -L..\windows-build\pthreads\Pre-built.2\lib -lpcreposix -lpcre -
L../windows-build/PCRE/lib/
sim_console.c:2246:26: Warnung: Übergabe des Arguments 1 von »localtime«
von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
loc_tm = *localtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
c:\mingw\include\time.h:236:45: Anmerkung: »const time_t * {aka const long
int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *localtime (const time_t *);
^~~~~~~~~
sim_console.c:2247:23: Warnung: Übergabe des Arguments 1 von »gmtime«
von inkompatiblem Zeigertyp [-Wincompatible-pointer-types]
gmt_tm = *gmtime (&sim_deb_basetime.tv_sec);
^
In file included from sim_timer.h:40:0,
from sim_defs.h:1036,
c:\mingw\include\time.h:235:45: Anmerkung: »const time_t * {aka const long
int *}« erwartet, aber Argument hat Typ »__time64_t * {aka long long int *}«
_CRTIMP __cdecl __MINGW_NOTHROW struct tm *gmtime (const time_t *);
^~~~~~
----------------
The executable builds, but....
The problem comes from some compatibility with Windows MSCRT
compatibility which defines struct timespec in <time.h> incompatibly as struct
timespec {
__time64_t tv_sec;
__int32 tv_nsec;
};
rather than
struct timespec {
time_t tv_sec;
time_t tv_nsec;
};
I wouldn't care about that if the pthreads library wouldn't also mess with
timespec, so it is likely something broken here even if the executable is built.
My recommendation is to add (in sim_console.c:2243) time_t temp =
sim_deb_basetime.tv_sec; and rewrite both localtime/gmtime function calls to
use &temp instead.
Regards
Holger
--
Sent by Exchange 2013
_______________________________________________
Simh mailing list
http://mailman.trailing-edge.com/mailman/listinfo/simh
Loading...