gpi-hash.c segfaults

Tue, 22 Jul 1997 16:52:24 +1100



--Message-Boundary-28150
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

I just applied both sets of patches to gpc to take it up to 970721 
(hopefully properly) and unfortunatly, gpc still segfaults in 
get_uid.

After some searching of the code for gpi-hash.c, and having a good 
look at my code that causes gpc to crash, I realised that there is no 
provision for REMOVING symbols (trees?) from the hash table.  I 
thought of looking for this because the files that cause me problems 
re-use parameter names or record member names.

If a tree that has been put in the hash table is ever destroyed (I 
don't know if this happens as I don't know the internals of gpc), it 
seems a pointer to the destroyed tree/hash bucket will still exist in 
the hash table.  This could very easily be causing the invalid 
pointer dereferencing.

Hmm, I just tried out my previous sample file (under windows 95) and 
got a crash as well, so my above reasoning may be incorrect.

here is the stack dump:
Exiting due to signal SIGSEGV
Page fault at eip=000ee4d0, error=0004
eax=0c000000 ebx=000003f1 ecx=ff905350 edx=ec000009 esi=ff905350 
edi=ff8e16a0
ebp=ff8de948 esp=ff8de944 program=C:\DJGPP\BIN\GPC1.EXE
cs: sel=0117  base=82f23000  limit=ff975fff
ds: sel=011f  base=82f23000  limit=ff975fff
es: sel=011f  base=82f23000  limit=ff975fff
fs: sel=00f7  base=0001d710  limit=0000ffff
gs: sel=012f  base=00000000  limit=ffffffff
ss: sel=011f  base=82f23000  limit=ff975fff
 
Call frame traceback EIPs:
  0x000ee4d0   _get_uid+32, line 134 of gpi-hash.c
  0x000ee61a   _hashed_save+34, line 197 of gpi-hash.c
  0x000ebf30   _store_tree+24, line 1139 of module.c
  0x000ec5a3   _store_tree+1675, line 1417 of module.c
  0x000ee741   _flush_suspended+133, line 246 of gpi-hash.c
  0x000ed89c   _create_gpi_files+576, line 2290 of module.c
  0x001113ef   _yyparse+31247, line 5994 of parse.c
  0x000c9de2   _compile_file+1510, line 2232 of toplev.c
  0x000cc1b9   _main+3221, line 3938 of toplev.c
  0x00120bc6   ___crt1_startup+290


the command line uses was:gpc -O2 -o foo.o -c foo.pas

The test file is attached.

Sigh, this is getting frustrating (and probably more so for you, 
Peter)


Bill
--
Leave others their otherness.

--Message-Boundary-28150
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  foo.pas
     Date:  17 Jul 1997, 15:04
     Size:  381 bytes.
     Type:  Program-source

--Message-Boundary-28150
Content-type: Application/Octet-stream; name="foo.pas"; type=Program-source
Content-disposition: attachment; filename="foo.pas"
Content-transfer-encoding: BASE64

dW5pdCBUcnVua1V0aTsNCmludGVyZmFjZQ0KDQp0eXBlIHdya3N0cmluZz1zdHJpbmdbMjU1
XTsNCg0KZnVuY3Rpb24gIEJpblRvRGVjKEJpbmFyeTogc3RyaW5nKSAgIDogTG9uZ0ludDsN
CmZ1bmN0aW9uICBEZWNUb0JpbihEZWNJbnB1dDogc3RyaW5nKSA6IHdya3N0cmluZzsNCg0K
aW1wbGVtZW50YXRpb24NCg0KZnVuY3Rpb24gQmluVG9EZWMoQmluYXJ5OiBzdHJpbmcpIDog
TG9uZ0ludDsNCmJlZ2luDQogIEJpblRvRGVjOj0wOw0KZW5kOw0KDQpmdW5jdGlvbiBEZWNU
b0JpbihEZWNJbnB1dDogc3RyaW5nKSA6IHdya3N0cmluZzsNCnZhcg0KICAgRGVjTnVtIDog
d29yZDsNCg0KYmVnaW4NCiAgUmVhZFN0cihEZWNJbnB1dCxEZWNOdW0pOw0KZW5kOw0KZW5k
Lg0K

--Message-Boundary-28150--


Bill Currie (billc@blackmagic.tait.co.nz)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es