[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

implicit.c matches not allocated enough memory

From: ian . willis
Subject: implicit.c matches not allocated enough memory
Date: Wed, 11 Jul 2001 14:00:53 +0100


I believe I have found a bug in make version 3.79.1. I am running on 
Sparc/Solaris 8. This bug exists in the distribution of gnu make with Solaris 8 
(version 3.78.1) and in the compiled binary package available at 
www.sunfreeware.com (3.79.1). With a
particular set of makefiles, I get a Segmentation Violation. I have traced this 
to the pattern_search function of implicit.c line 133. This line allocates 
memory for storing rule match indicies. Since a rule may be included in 
tryrules multiple times (see
comment on line 277), it is possible that more that num_pattern_rules elements 
are stored in matches. In my case, nrules was being set to 17 whilst 
num_pattern_rules was set to 16. Setting matches[16] was overwriting 
tryrules[0]. I believe that lines
132-133 should be replaced with:

  unsigned int *matches
    = (unsigned int *) alloca (num_pattern_rules * max_pattern_targets
                               * sizeof (unsigned int));

This is similar to the allocation of tryrules (which has the same number of 
elements as matches). With this fix I am able to make my project sucessfully.

I am working on a large project and am unable to extract all makefiles from it 
as an example.



Ian Willis
Digital Broadcast Systems
Philips Semiconductors Systems Laboratory, Southampton
email: address@hidden                    tel: +44 (0)23 80702701

reply via email to

[Prev in Thread] Current Thread [Next in Thread]