| From: | Bruce Momjian <bruce(at)momjian(dot)us> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Subject: | New compiler warning |
| Date: | 2023-08-30 11:55:28 |
| Message-ID: | ZO8uMPmZ4zb37PpQ@momjian.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
I am seeing a new gcc 12.2.0 compiler warning from
src/backend/commands/sequence.c:
sequence.c: In function ‘DefineSequence’:
sequence.c:196:35: warning: ‘coldef’ may be used uninitialized [-Wmaybe-uninitialized]
196 | stmt->tableElts = lappend(stmt->tableElts, coldef);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sequence.c:175:29: note: ‘coldef’ was declared here
175 | ColumnDef *coldef;
| ^~~~~~
The code is:
for (i = SEQ_COL_FIRSTCOL; i <= SEQ_COL_LASTCOL; i++)
{
--> ColumnDef *coldef;
switch (i)
{
case SEQ_COL_LASTVAL:
coldef = makeColumnDef("last_value", INT8OID, -1, InvalidOid);
value[i - 1] = Int64GetDatumFast(seqdataform.last_value);
break;
case SEQ_COL_LOG:
coldef = makeColumnDef("log_cnt", INT8OID, -1, InvalidOid);
value[i - 1] = Int64GetDatum((int64) 0);
break;
case SEQ_COL_CALLED:
coldef = makeColumnDef("is_called", BOOLOID, -1, InvalidOid);
value[i - 1] = BoolGetDatum(false);
break;
}
coldef->is_not_null = true;
null[i - 1] = false;
--> stmt->tableElts = lappend(stmt->tableElts, coldef);
}
and I think it is caused by this commit:
commit 1fa9241bdd
Author: Peter Eisentraut <peter(at)eisentraut(dot)org>
Date: Tue Aug 29 08:41:04 2023 +0200
Make more use of makeColumnDef()
Since we already have it, we might as well make full use of it,
instead of assembling ColumnDef by hand in several places.
Reviewed-by: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da(at)eisentraut(dot)org
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aleksander Alekseev | 2023-08-30 12:10:20 | Re: New compiler warning |
| Previous Message | Dilip Kumar | 2023-08-30 11:21:19 | Re: New WAL record to detect the checkpoint redo location |