Re: [PUSHED] value.c (value_contents_bits_eq): Initialize l,h for gcc, -Wall. (was: Re: [PATCH v2] Handle partially optimized out values similarly to unavailable values)

Andrew Pinski
2014-08-20T16:28:12Z

On Wed, Aug 20, 2014 at 3:32 AM, Pedro Alves <palves@redhat.com> wrote:
> On 08/20/2014 10:46 AM, Pedro Alves wrote:
>> On 08/20/2014 01:54 AM, Andrew Pinski wrote:
>>> On Tue, Aug 19, 2014 at 4:36 PM, Pedro Alves <palves@redhat.com> wrote:
>>
>>
>>>> Great, I pushed this in then.
>>>
>>> This caused a build error for me:
>>>
>>> cc1: warnings being treated as errors
>>> ../../gdb/value.c: In function ‘value_contents_eq’:
>>> ../../gdb/value.c:830: error: ‘l’ may be used uninitialized in this function
>>> ../../gdb/value.c:830: note: ‘l’ was declared here
>>> ../../gdb/value.c:830: error: ‘h’ may be used uninitialized in this function
>>> ../../gdb/value.c:830: note: ‘h’ was declared here
>>> make[2]: *** [value.o] Error 1
>>>
>>> Thanks,
>>> Andrew Pinski
>>
>> Thanks Andrew. I'm looking.
>>
>
> I can't trigger that, but should be fixed now.

Yes this fixes the issue for me.

Thanks,
Andrew

>
> Thanks.
>
> ------------
> value.c (value_contents_bits_eq): Initialize l,h for gcc -Wall.
>
> gdb/
> * value.c (value_contents_bits_eq): Initialize l,h for gcc -Wall.
> ---
> gdb/ChangeLog | 4 ++++
> gdb/value.c | 2 +-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 55cc92c..c0b4f82 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,7 @@
> +2014-08-20 Pedro Alves <palves@redhat.com>
> +
> + * value.c (value_contents_bits_eq): Initialize l,h for gcc -Wall.
> +
> 2014-08-20 Yao Qi <yao@codesourcery.com>
>
> * amd64-tdep.c (amd64_classify): Add a blank line after the
> diff --git a/gdb/value.c b/gdb/value.c
> index b74f23a..09ee1ca 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -827,7 +827,7 @@ value_contents_bits_eq (const struct value *val1, int offset1,
>
> while (length > 0)
> {
> - ULONGEST l, h;
> + ULONGEST l = 0, h = 0; /* init for gcc -Wall */
> int i;
>
> for (i = 0; i < 2; i++)
> --
> 1.9.3
>
>
>
> --
> Thanks,
> Pedro Alves