Re: Bus error when writing in a typed file

Maurice Lombardi <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
Le 18/11/2012 10:16, Baudouin Le Charlier a écrit :
> Here is a very simple example where the bus error occurs : Le 18 nov.
> 2012 à 02:44, Waldek Hebisch a écrit :
>
>>> Hmm, quick test with Debian gpc did not produce a crash.  It
>>> certainly
>> would help to have example without a lot of interaction.

with busError.pas
  =======================================================
On fedora core 6

[lombardi@lobelie ~/gpc/bugCharlier]$ gpc -v
Reading specs from /usr/local/lib/gcc/x86_64-redhat-linux/3.4.4/specs
Configured with: ../gcc-3.4.4-20050721/configure --disable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,pascal --enable-multilib --host=x86_64-redhat-linux
Thread model: posix
gpc version 20070904, based on gcc-3.4.4 20050721 (Red Hat 3.4.4-2)
[lombardi@lobelie ~/gpc/bugCharlier]$ gp --version
GP version 0.61 (GNU Pascal Make Utility)
...
[lombardi@lobelie ~/gpc/bugCharlier]$ gp busError.pas
[lombardi@lobelie ~/gpc/bugCharlier]$ ./busError
Segmentation fault

=========================================================
on MingW with DrMingw for JIT debug (understands only stabs)

Maurice@bouvardie ~/gpc/bugCharlier
$ gpc -v
Reading specs from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-2/configure --with-gcc
--with-gnu-ld --wi
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
--enable-threads --dis
able-nls --enable-languages=c,pascal --disable-win32-registry
--disable-shared -
-enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x
--enable-
java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchron
ization --enable-libstdcxx-debug
Thread model: win32
gpc version 20070904, based on gcc-3.4.5 (mingw-vista special r3)

Maurice@bouvardie ~/gpc/bugCharlier
$ gp --version
GP version 0-61 (GNU Pascal Make Utility)

Maurice@bouvardie ~/gpc/bugCharlier
$ gp busError -gstabs+

Maurice@bouvardie ~/gpc/bugCharlier
$ busError

DrMingw pops up with message

.............
busError.exe caused an Access Violation at location 0040139d in module 
busError.exe Reading from location 00000594.

Registers:
eax=80000000 ebx=7ffdc000 ecx=00000000 edx=00000304 esi=00432009 
edi=0023ff11
eip=0040139d esp=0023feb0 ebp=0023ff28 iopl=0         nv up ei pl zr na 
po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000 
efl=00000246

Call stack:
AddrPC     AddrReturn AddrFrame  AddrStack  Params
0040139D   004016C0   0023FF28   0023FEB0   00000001   00032C00 
00032F20   00000000
0040139D  busError.exe:0040139D  _p__M0_main_program  buserror.pas:28
Void _p__M0_main_program(
	
)
	...
	begin
	      assign(f, 'toto.pers') ;
 >	      rewrite(f) ;
	      write(f, p) ;
	      close(f)
	...

004016C0   004010FD   0023FF58   0023FEB0   00000001   00032C00 
00032F20   00437000
004016C0  busError.exe:004016C0  main  <implicit code>:31
int32 main(
	int32 argc = 1,
	Cstring * argv = &0x00032bb9,
	Cstring * envp = &0x00032ff0
)
004010FD   00000000   0023FFF0   0023FEB0   00401280   00000000 
78746341   00000020
004010FD 
busError.exe:004010FDc:\Lombardi\mingw\gpc\bugCharlier\busError.exe: No 
symbol found

.................

Maurice

-- 
        Maurice Lombardi
Laboratoire Interdisciplinaire de Physique,
     (ex Spectrometrie Physique)
Universite Joseph Fourier de Grenoble, BP87
38402 Saint Martin d'Heres Cedex     FRANCE
Tel: 33 (0)4 76 51 47 51
Fax: 33 (0)4 76 63 54 95
mailto:[email protected]

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.