🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #1761

The problem with GNU malloc and gcc found

#1761
From: Jyrki Kuoppala
Date: Mon, 12 Jun 1989 15:58
23 lines
1466 bytes
In article <8906120152.AA00707@cs.hut.fi>, I write:
>When compiling emacs 18.54 (or actually any GNU program with GNU
>malloc) the program core dumps if malloc.c is compiled with gcc.  It
>doesn't matter if malloc is compiled with -O or not.  When malloc is
>compiled with cc, everything works fine.
>
>Environment: gcc 1.35, emacs 18.54 (or newest GDB), Altos 3068 (m68k
>running USG5.2.2).
>
>The problem seems kind of strange, since it appears only on the Altos;
>on m68k-suns, 68030-sonys, sparcs and vaxen it works fine.

I found the problem; it appears that the Altos C compiler returns
pointers in a0 instead of d0 as gcc does.  So, when fgets() from the
Altos c library calls malloc() to allocate some memory, it thinks that
malloc() returns the value in a0, which actually contains garbage.
After this, when the garbage value is used and free()ed, free() of
course complains about this.

So I guess I'll have a look at how to configure gcc to return pointers
both in d0 and a0; this is what the altos cc does.

//Jyrki
Technical Details
Message-ID: <8906121558.AA05179@cs.hut.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!SAUNA.HUT.FI!jkp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!SAUNA.HUT.FI!jkp
From: jkp@SAUNA.HUT.FI (Jyrki Kuoppala)
Newsgroups: gnu.emacs.bug
Subject: The problem with GNU malloc and gcc found
Message-ID: <8906121558.AA05179@cs.hut.fi>
Date: 12 Jun 89 15:58:55 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Helsinki University of Technology, Finland.
Lines: 23