davida@isil.ai.mit.edu (David Axmark) (09/24/89)
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 ...)
dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) (09/28/89)
> From: davida@isil.ai.mit.edu (David Axmark) > Newsgroups: gnu.utils.bug > 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... Here's a fix, which includes your patches to function.c (yours were reversed normal diffs - context diffs are preferable). The first hunk is the fix for looping, the rest are your fix for freeing wrong memory. RCS file: src/RCS/function.c,v retrieving revision 3.56 diff -c -r3.56 src/function.c *** /tmp/,RCSt1a08524 Wed Sep 27 16:14:13 1989 --- src/function.c Wed Sep 27 15:49:59 1989 *************** *** 67,73 **** /* Struck out. Output the rest of the string that is no longer to be replaced. */ o = variable_buffer_output (o, subst, slen); ! continue; } /* Advance T past the string to be replaced. */ --- 67,75 ---- /* Struck out. Output the rest of the string that is no longer to be replaced. */ o = variable_buffer_output (o, subst, slen); ! /* Advance T past the string to be replaced. */ ! t = p + slen; ! continue; } /* Advance T past the string to be replaced. */ *************** *** 860,866 **** BADARGS ("word"); text = expand_argument (text, p); ! p = expand_argument (p + 1, end); /* Check the first argument. */ for (p2 = text; *p2 != '\0'; ++p2) --- 862,869 ---- BADARGS ("word"); text = expand_argument (text, p); ! p3 = expand_argument (p + 1, end); ! p = p3; /* Check the first argument. */ for (p2 = text; *p2 != '\0'; ++p2) *************** *** 881,887 **** o = variable_buffer_output (o, p, len); free (text); ! free (p); break; case function_words: --- 884,890 ---- o = variable_buffer_output (o, p, len); free (text); ! free (p3); break; case function_words: @alex -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy