This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gcc/gcc.c: XNEWVEC enough space for 'saved_suffix' using


Thank you very much for your work. Especially give a complete sample for
the whole working flow, which I shall follow.

For me, if no related documents for it, I recommend to put a complete
sample (e.g. this one) to a related document which can be referenced by
other newbies.

By the way, with your aid, my original plan "a patch per month" is
succeed, or it must be fail for 2014-07, thanks.

On 08/01/2014 06:36 AM, Jeff Law wrote:
> On 07/24/14 09:31, Chen Gang wrote:
>> strlen() will get string length excluding '\0', but strcpy() will append
>> '\0' in the end, so need XNEWVEC additional byte, or cause memory over
>> flow.
>>
>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>> ---
>>   gcc/gcc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/gcc.c b/gcc/gcc.c
>> index 6cd08ea..8ea46ec 100644
>> --- a/gcc/gcc.c
>> +++ b/gcc/gcc.c
>> @@ -4895,7 +4895,7 @@ do_spec_1 (const char *spec, int inswitch, const
>> char *soft_matched_part)
>>                 {
>>               saved_suffix
>>                 = XNEWVEC (char, suffix_length
>> -                     + strlen (TARGET_OBJECT_SUFFIX));
>> +                     + strlen (TARGET_OBJECT_SUFFIX) + 1);
>>               strncpy (saved_suffix, suffix, suffix_length);
>>               strcpy (saved_suffix + suffix_length,
>>                   TARGET_OBJECT_SUFFIX);
> Thanks.  I've installed this on the trunk after bootstrapping and
> regression testing on x86_64-unknown-linux-gnu
> 

Thank you for your work.

> In the future, please do a bootstrap & regression test when submitting
> patches and indicate which platform you did the testing on.
> 
> In essence the process looks like
> 
> make
> make check
> <save various .sum files>
> <apply patch>
> make clean
> make
> make check
> <compare .sum files>
> 

Thanks, I shall follow, next.

> 
> It seems tedious for simple patches, but the requirements for
> bootstrapping and regression testing keep the tip of the trunk from
> getting broken too often (which is very costly for everyone when it
> occurs).
> 

That sounds reasonable to me.

> You also need to provide a ChangeLog entry.  The details of what belongs
> in a ChangeLog are on the web site.  Here's an example for your patch:
> 
> 2014-07-31  Chen Gang  <gang.chen.5i5j@gmail.com>
> 
>         * gcc.c (do_spec_1): Allocate enough space for saved_suffix.
> 

Thanks, I shall follow, next.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]