psmedley / gcc

GNU General Public License v2.0
7 stars 1 forks source link

inet_makeaddr() #29

Open SilvanScherrer opened 6 years ago

SilvanScherrer commented 6 years ago

inet_makeaddr() crashes in gcc 4.9.2 the crash is like: [E:\trees\tests]inet

Killed by SIGSEGV pid=0x87b0 ppid=0x159b tid=0x0001 slot=0x00b1 pri=0x0200 mc=0x0001 ps=0x0010 E:\TREES\TESTS\INET.EXE TCPIP32 0:0000cd70 cs:eip=005b:1f86cd70 ss:esp=0053:0012ff8c ebp=0012ffa0 ds=0053 es=0053 fs=150b gs=0000 efl=00010206 eax=00000000 ebx=0012ffa8 ecx=58e9fd00 edx=00000000 edi=00000000 esi=00000000 Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.

this .c file demonstrates the issue inet.txt

psmedley commented 6 years ago

The resulting executable crashes in TCPIP32 with GCC 3.3.5 and GCC 8.1.0

dmik commented 6 years ago

This is a two-step problem.

  1. kLIBC headers are wrong. They define TCPCALL as nothing (due to __USE_LIBC_TCPIP) while it should be _System (as this is the calling convention of TCPIP32.DLL which may be seen in Toolkit headers as well).

  2. _System support in GCC4 is still not complete compared to GCC3. If you build the test by adding #define TCPCALL _System before the includes, it will work like a charm in any GCC3 version. I remember myself doing a number of fixes to _System in GCC4 to bring this support back but apparently I didn't pay attention to the problem of returning structures by value.

GCC3 code for _System needs to be learned carefully to understand how this can be transferred to GCC4.