diff mbox

libgo patch committed: Merge from revision 18783 of master

Message ID CAKOQZ8wqD8vks0yxCZro_GAiZY4Sw0iDC3P9KP1nrcArrTtTJA@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor June 10, 2014, 12:37 a.m. UTC
And I also forgot to attach the patch.  Sorry about this.

On Mon, Jun 9, 2014 at 5:37 PM, Ian Lance Taylor <iant@google.com> wrote:
> Forgot to CC gofrontend-dev.
>
> On Mon, Jun 9, 2014 at 5:36 PM, Ian Lance Taylor <iant@google.com> wrote:
>> On Mon, Jun 9, 2014 at 1:12 PM, Gary Funck <gary@intrepid.com> wrote:
>>> On 06/04/14 18:28:17, Ian Lance Taylor wrote:
>>>> I have committed a patch to libgo to merge from revision
>>>> 18783:00cce3a34d7e of the master library.
>>>
>>> Based on trunk rev. 211365, we're seeing this warning:
>>>
>>> libgo/runtime/chan.c:484:7: error: ‘received’ may be used uninitialized
>>> in this function [-Werror=maybe-uninitialized]
>>>   bool received;
>>>        ^
>>
>> Thanks for the report.  There is no bug here, the control flow is just
>> too complicated for the compiler to sort out.  I don't know why I'm
>> not seeing the warning, but in any case the fix is simple.  This patch
>> bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
>> mainline.
>>
>> Ian

Comments

Gary Funck June 10, 2014, 2:55 a.m. UTC | #1
On Mon, Jun 9, 2014 at 5:36 PM, Ian Lance Taylor <iant@google.com> wrote:
> There is no bug here, the control flow is just too complicated
> for the compiler to sort out.  I don't know why I'm
> not seeing the warning [...]

We have these compilation flags set:

  CFLAGS='-g3 -O3'
  CFLAGS_FOR_BUILD='-g3 -O3'
  CFLAGS_FOR_TARGET='-g3 -O3'

I tried "make CFLAGS='-g3 -O2' chan.lo"
(the default) and it compiled without complaint.
diff mbox

Patch

diff -r e632610ff06a libgo/runtime/chan.c
--- a/libgo/runtime/chan.c	Fri Jun 06 14:52:01 2014 -0700
+++ b/libgo/runtime/chan.c	Mon Jun 09 17:34:47 2014 -0700
@@ -481,7 +481,7 @@ 
 _Bool
 runtime_chanrecv2(ChanType *t, Hchan* c, byte* v)
 {
-	bool received;
+	bool received = false;
 
 	chanrecv(t, c, v, true, &received);
 	return received;