From: Pedro Alves <palves@redhat.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/3] Simplify event-loop core, remove two-step event processing
Date: Wed, 04 Feb 2015 10:51:00 -0000 [thread overview]
Message-ID: <54D1F9A6.5050309@redhat.com> (raw)
In-Reply-To: <CA+C-WL_S7MTCb5rLWbpkMbR0JMQvH98mrWD-sZ50erNhVkN6JQ@mail.gmail.com>
On 02/03/2015 11:48 PM, Patrick Palka wrote:
> This patch causes a build failure when compiling GDB with GCC 4.9:
>
> /home/patrick/code/binutils-gdb/gdb/event-loop.c: In function
> âgdb_do_one_eventâ:
> /home/patrick/code/binutils-gdb/gdb/event-loop.c:296:10: error: âresâ
> may be used uninitialized in this function
> [-Werror=maybe-uninitialized]
> if (res > 0)
> ^
>
Bah, -O0 vs -O2. I've pushed the fix below.
-------
Subject: [PATCH] Fix build breakage due to event loop simplification
commit 70b66289 (Simplify event-loop core, remove two-step event
processing) causes a build failure when compiling GDB with gcc/-O2:
gdb/event-loop.c: In function âgdb_do_one_eventâ:
gdb/event-loop.c:296:10: error: âresâ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
if (res > 0)
^
GCC isn't realizing that event_source_head can never be > 2 and that
therefore 'res' is always initialized in all possible paths. Adding a
default case that internal_error's makes GCC realize that.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-02-04 Pedro Alves <palves@redhat.com>
Fix build breakage.
* event-loop.c (gdb_do_one_event): Add default switch case.
---
gdb/ChangeLog | 5 +++++
gdb/event-loop.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2266c11..1116853 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-04 Pedro Alves <palves@redhat.com>
+
+ Fix build breakage.
+ * event-loop.c (gdb_do_one_event): Add default switch case.
+
2015-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Filter out inferior gcc option -fpreprocessed.
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 7425b3a..a2b41a7 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -287,6 +287,10 @@ gdb_do_one_event (void)
/* Are there any asynchronous event handlers ready? */
res = check_async_event_handlers ();
break;
+ default:
+ internal_error (__FILE__, __LINE__,
+ "unexpected event_source_head %d",
+ event_source_head);
}
event_source_head++;
--
1.9.3
next prev parent reply other threads:[~2015-02-04 10:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-26 17:32 [PATCH 0/3] Fix racy FAILs of sigall-reverse.exp (and more) Pedro Alves
2015-01-26 17:19 ` [PATCH 2/3] When disabling target async, remove all target event sources from the event loop Pedro Alves
2015-01-26 17:46 ` [PATCH 1/3] Fix up some target is-async vs can-async confusions Pedro Alves
2015-01-26 19:16 ` [PATCH 3/3] Simplify event-loop core, remove two-step event processing Pedro Alves
2015-02-03 22:48 ` Patrick Palka
2015-02-04 10:51 ` Pedro Alves [this message]
2015-02-04 17:34 ` Alex Velenko
2015-02-04 18:18 ` Pedro Alves
2015-02-04 9:49 ` Sergio Durigan Junior
2015-02-03 15:27 ` [PATCH 0/3] Fix racy FAILs of sigall-reverse.exp (and more) Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54D1F9A6.5050309@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=patrick@parcs.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox