Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!pacific.mps.ohio-state.edu!tut.cis.ohio-state.edu!isil.ai.mit.edu!davida
From: davida@isil.ai.mit.edu (David Axmark)
Newsgroups: gnu.utils.bug
Subject: Wrong memory freed in GNUmake 3.55
Message-ID: <8909241440.AA01226@isil.se>
Date: 24 Sep 89 15:40:36 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 37


This make file core dumps on my system. (DG AViiON DGUX 4.10)

skr:;		echo $(word 5, foo bar baz dcdc ed wed wed wed wed wed )

The reason seams to be a free of the wrong pointer in function.c. Here
is my fix.

diff function.c function.c.org
879,880c879
<       p3 = expand_argument (p + 1, end);
<       p = p3;
---
>       p = expand_argument (p + 1, end);
901c900
<       free (p3);
---
>       free (p);



Another smaller bug.
If patsubst is used without a % in the pattern as in the following makefile.

all:;	echo $(patsubst /,, $(dir doo/ddd))

On my system make loops on this makefile and takes all my memory... 
I would be nice if it would generate a error message instead.


David Axmark
EMAIL:	davida@isil.se  or davida@emil.csd.uu.se
        or mcvax!sunic!kuling!isil!davida
MAIL:	Detron HB, Noreens vag 16, 752 63 UPPSALA, SWEDEN
PHONE:	+ (46) 18 - 11 07 80

(I can't spell in ANY language ...)