public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Fix compiler errors/warnings when compiling with -O3
@ 2015-09-23 15:20 Evgeny Grin
  2015-10-20 10:34 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Evgeny Grin @ 2015-09-23 15:20 UTC (permalink / raw)
  To: cygwin-patches

GCC find more suspicious places with -O3. Cygwin use -Werror so uninitialized variables prevent compilations.
This patch allow compilation with CFLAGS='-O3' CXXFLAGS='-O3'.


---
 winsup/cygwin/fhandler_socket.cc | 4 ++--
 winsup/cygwin/regex/regcomp.c    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index ecb6198..658dca7 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -746,7 +746,7 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags)
     return 0;
 
   int ret;
-  long events;
+  long events = 0;
 
   while (!(ret = evaluate_events (event_mask, events, !(flags & MSG_PEEK)))
 	 && !events)
@@ -1160,7 +1160,7 @@ int
 fhandler_socket::connect (const struct sockaddr *name, int namelen)
 {
   struct sockaddr_storage sst;
-  int type;
+  int type = 0;
 
   if (get_inet_addr (name, namelen, &sst, &namelen, &type, connect_secret)
       == SOCKET_ERROR)
diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c
index d68dcc3..554b43a 100644
--- a/winsup/cygwin/regex/regcomp.c
+++ b/winsup/cygwin/regex/regcomp.c
@@ -1246,7 +1246,7 @@ freeset(struct parse *p, cset *cs)
 static wint_t
 singleton(cset *cs)
 {
-	wint_t i, s, n;
+	wint_t i, s = OUT, n;
 
 	for (i = n = 0; i < NC; i++)
 		if (CHIN(cs, i)) {
-- 
2.5.1.windows.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix compiler errors/warnings when compiling with -O3
  2015-09-23 15:20 [PATCH] Fix compiler errors/warnings when compiling with -O3 Evgeny Grin
@ 2015-10-20 10:34 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2015-10-20 10:34 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Evgeny Grin

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Hi Evgeny,

On Sep 23 18:20, Evgeny Grin wrote:
> GCC find more suspicious places with -O3. Cygwin use -Werror so uninitialized variables prevent compilations.
> This patch allow compilation with CFLAGS='-O3' CXXFLAGS='-O3'.

Patch applied.  I added a ChangeLog entry for this simple case.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-20 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 15:20 [PATCH] Fix compiler errors/warnings when compiling with -O3 Evgeny Grin
2015-10-20 10:34 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).