pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Subject: Re: "may be unused" warnings for gcc
Date: Wed, 22 Feb 2017 09:26:10 -0500
Message-ID: <15fb2350-b8b8-e188-278f-0b34fdee5210@2ndquadrant.com> (raw )
In-Reply-To: <20170222031722.kof3yzn5jfnf6jy4@alap3.anarazel.de >
References: <20170220144118.qqq3zp2lnuq52e4c@alap3.anarazel.de >
<d7d56258-a632-43e9-fdf2-4d35e257c8ad@2ndquadrant.com >
<20170222031722.kof3yzn5jfnf6jy4@alap3.anarazel.de >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 2/21/17 22:17, Andres Freund wrote:
> I've not run comparisons this year, but late last year I was seeing > 5%
> < 10% benefits - that seems plenty enough to care.
You mean the 5-minute benchmarks on my laptop are not representative? ;-)
Here is a patch that I had lying around that clears the compiler
warnings under -O3 for me. It seems that they are a subset of what you
are seeing. Plausibly, as compilers are doing more analysis in larger
scopes, we can expect to see more of these.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Attachments:
0001-Silence-compiler-warnings-from-gcc-O3.patch (text/x-patch, 2.8K) download
From 2a73d3ac095435ecbe3aefff7bcecc292675e167 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Wed, 22 Feb 2017 09:23:40 -0500
Subject: [PATCH] Silence compiler warnings from gcc -O3
---
src/backend/commands/dbcommands.c | 13 +++++++------
src/backend/utils/adt/varlena.c | 6 ++++++
src/backend/utils/misc/guc.c | 2 +-
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 1ebacbc24f..2a23f634c5 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -27,6 +27,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
+#include "access/multixact.h"
#include "access/xact.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
@@ -103,14 +104,14 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
Relation rel;
Oid src_dboid;
Oid src_owner;
- int src_encoding;
- char *src_collate;
- char *src_ctype;
+ int src_encoding = -1;
+ char *src_collate = NULL;
+ char *src_ctype = NULL;
bool src_istemplate;
bool src_allowconn;
- Oid src_lastsysoid;
- TransactionId src_frozenxid;
- MultiXactId src_minmxid;
+ Oid src_lastsysoid = InvalidOid;
+ TransactionId src_frozenxid = InvalidTransactionId;
+ MultiXactId src_minmxid = InvalidMultiXactId;
Oid src_deftablespace;
volatile Oid dst_deftablespace;
Relation pg_database_rel;
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 28b5745ba8..7da7535b3b 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -1129,6 +1129,8 @@ text_position_setup(text *t1, text *t2, TextPositionState *state)
state->use_wchar = false;
state->str1 = VARDATA_ANY(t1);
state->str2 = VARDATA_ANY(t2);
+ state->wstr1 = 0;
+ state->wstr2 = 0;
state->len1 = len1;
state->len2 = len2;
}
@@ -1144,6 +1146,8 @@ text_position_setup(text *t1, text *t2, TextPositionState *state)
len2 = pg_mb2wchar_with_len(VARDATA_ANY(t2), p2, len2);
state->use_wchar = true;
+ state->str1 = 0;
+ state->str2 = 0;
state->wstr1 = p1;
state->wstr2 = p2;
state->len1 = len1;
@@ -1227,6 +1231,8 @@ text_position_setup(text *t1, text *t2, TextPositionState *state)
state->skiptable[wstr2[i] & skiptablemask] = last - i;
}
}
+ else
+ state->skiptablemask = 255;
}
static int
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 24771389c8..107e1f2957 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -9275,7 +9275,7 @@ RestoreGUCState(void *gucstate)
char *varname,
*varvalue,
*varsourcefile;
- int varsourceline;
+ int varsourceline = -1;
GucSource varsource;
GucContext varscontext;
char *srcptr = (char *) gucstate;
--
2.11.1
view thread (5+ messages) latest in thread
Message-ID: <15fb2350-b8b8-e188-278f-0b34fdee5210@2ndquadrant.com>
Permalink: ../15fb2350-b8b8-e188-278f-0b34fdee5210@2ndquadrant.com/
Also on: postgresql.org/message-id/15fb2350-b8b8-e188-278f-0b34fdee5210@2ndquadrant.com
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, andres@anarazel.de
Subject: Re: "may be unused" warnings for gcc
In-Reply-To: <15fb2350-b8b8-e188-278f-0b34fdee5210@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox