Patchwork Fix 32-bit bootstrap on PowerPC

login
register
mail settings
Submitter Pat Haugen
Date Nov. 9, 2010, 11:27 p.m.
Message ID <4CD9D8D0.9090000@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/70590/
State New
Headers show

Comments

Pat Haugen - Nov. 9, 2010, 11:27 p.m.
Is the following an obvious patch? It fixes the recent error I see 
during 32-bit bootstrap (not sure why I don't see the same for 64-bit).


/home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c: In function 
#decode_cmdline_options_to_array#:
/home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:543:4: error: 
#separate_args# may be used uninitialized in this function 
[-Werror=uninitialized]
/home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:290:43: note: 
#separate_args# was declared here
cc1: all warnings being treated as errors



-Pat


2010-11-09  Pat Haugen <pthaugen@us.ibm.com>

     * opts-common.c (decode_cmdline_option): Initialize separate_args.
Pat Haugen - Nov. 11, 2010, 9:59 p.m.
On 11/9/2010 5:27 PM, Pat Haugen wrote:
> Is the following an obvious patch? It fixes the recent error I see 
> during 32-bit bootstrap (not sure why I don't see the same for 64-bit).
>
>
> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c: In function 
> #decode_cmdline_options_to_array#:
> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:543:4: error: 
> #separate_args# may be used uninitialized in this function 
> [-Werror=uninitialized]
> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:290:43: note: 
> #separate_args# was declared here
> cc1: all warnings being treated as errors
>
>
>
> -Pat
>
>
> 2010-11-09  Pat Haugen <pthaugen@us.ibm.com>
>
>     * opts-common.c (decode_cmdline_option): Initialize separate_args.
>
>
> Index: opts-common.c
> ===================================================================
> --- opts-common.c       (revision 166498)
> +++ opts-common.c       (working copy)
> @@ -287,7 +287,7 @@ decode_cmdline_option (const char **argv
>    size_t opt_index;
>    const char *arg = 0;
>    int value = 1;
> -  unsigned int result = 1, i, extra_args, separate_args;
> +  unsigned int result = 1, i, extra_args, separate_args = 0;
>    int adjust_len = 0;
>    size_t total_len;
>    char *p;
>
Richard Guenther - Nov. 12, 2010, 10:08 a.m.
On Thu, Nov 11, 2010 at 10:59 PM, Pat Haugen
<pthaugen@linux.vnet.ibm.com> wrote:
> On 11/9/2010 5:27 PM, Pat Haugen wrote:
>>
>> Is the following an obvious patch? It fixes the recent error I see during
>> 32-bit bootstrap (not sure why I don't see the same for 64-bit).
>>
>>
>> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c: In function
>> #decode_cmdline_options_to_array#:
>> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:543:4: error:
>> #separate_args# may be used uninitialized in this function
>> [-Werror=uninitialized]
>> /home/pthaugen/src/gcc/trunk/gcc/gcc/opts-common.c:290:43: note:
>> #separate_args# was declared here
>> cc1: all warnings being treated as errors

Hmm, it looks like it can be used uninitialized but 0 looks like a
valid default value.

Thus, the patch is ok.

Thanks,
Richard.

>>
>>
>> -Pat
>>
>>
>> 2010-11-09  Pat Haugen <pthaugen@us.ibm.com>
>>
>>    * opts-common.c (decode_cmdline_option): Initialize separate_args.
>>
>>
>> Index: opts-common.c
>> ===================================================================
>> --- opts-common.c       (revision 166498)
>> +++ opts-common.c       (working copy)
>> @@ -287,7 +287,7 @@ decode_cmdline_option (const char **argv
>>   size_t opt_index;
>>   const char *arg = 0;
>>   int value = 1;
>> -  unsigned int result = 1, i, extra_args, separate_args;
>> +  unsigned int result = 1, i, extra_args, separate_args = 0;
>>   int adjust_len = 0;
>>   size_t total_len;
>>   char *p;
>>
>
>
>

Patch

Index: opts-common.c
===================================================================
--- opts-common.c       (revision 166498)
+++ opts-common.c       (working copy)
@@ -287,7 +287,7 @@  decode_cmdline_option (const char **argv
    size_t opt_index;
    const char *arg = 0;
    int value = 1;
-  unsigned int result = 1, i, extra_args, separate_args;
+  unsigned int result = 1, i, extra_args, separate_args = 0;
    int adjust_len = 0;
    size_t total_len;
    char *p;