Thread: Re: [HACKERS] [COMMITTERS] pgsql: Remove objname/objargs split for referring to objects
Re: [HACKERS] [COMMITTERS] pgsql: Remove objname/objargs split for referring to objects
From
Michael Paquier
Date:
On Thu, Mar 16, 2017 at 12:18 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote: > Peter Eisentraut wrote: >> Remove objname/objargs split for referring to objects > > I don't know if this is the guilty commit, but I'm now getting these > compiler warnings: > > > /pgsql/source/master/src/backend/catalog/objectaddress.c: In function 'get_object_address': > /pgsql/source/master/src/backend/catalog/objectaddress.c:1624:33: warning: 'typenames[1]' may be used uninitialized inthis function [-Wmaybe-uninitialized] > ereport(ERROR, > ^ > /pgsql/source/master/src/backend/catalog/objectaddress.c:1578:8: note: 'typenames[1]' was declared here > char *typenames[2]; > ^ > /pgsql/source/master/src/backend/catalog/objectaddress.c:1624:33: warning: 'typenames[0]' may be used uninitialized inthis function [-Wmaybe-uninitialized] > ereport(ERROR, > ^ > /pgsql/source/master/src/backend/catalog/objectaddress.c:1578:8: note: 'typenames[0]' was declared here > char *typenames[2]; > ^ What are you using as CFLAGS? As both typenames should be normally set, what about initializing those fields with NULL and add an assertion like the attached? -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Attachment
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referringto objects
From
Alvaro Herrera
Date:
Michael Paquier wrote: > What are you using as CFLAGS? As both typenames should be normally > set, what about initializing those fields with NULL and add an > assertion like the attached? Actually, my compiler was right -- this was an ancient bug I introduced in 9.5 (commit a61fd533), and this new warning was my compiler being a bit smarter now for some reason. The problem is we were trying to extract String value from a TypeName node, which obviously doesn't work very well. I pushed a real fix, not just a compiler-silencer, along with a few lines in object_address.sql to make sure it works properly. Maybe we need a few more tests cases for other parts of pg_get_object_address. Pushed fix, backpatched to 9.5. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referring toobjects
From
Peter Eisentraut
Date:
On 3/16/17 11:56, Alvaro Herrera wrote: > Michael Paquier wrote: > >> What are you using as CFLAGS? As both typenames should be normally >> set, what about initializing those fields with NULL and add an >> assertion like the attached? > > Actually, my compiler was right -- this was an ancient bug I introduced > in 9.5 (commit a61fd533), and this new warning was my compiler being a > bit smarter now for some reason. The problem is we were trying to > extract String value from a TypeName node, which obviously doesn't work > very well. > > I pushed a real fix, not just a compiler-silencer, along with a few > lines in object_address.sql to make sure it works properly. Maybe we > need a few more tests cases for other parts of pg_get_object_address. > > Pushed fix, backpatched to 9.5. I am now seeing the warnings that Michael was reporting *after* your commit in 9.5 and 9.6. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referringto objects
From
Alvaro Herrera
Date:
Peter Eisentraut wrote: > On 3/16/17 11:56, Alvaro Herrera wrote: > > Michael Paquier wrote: > > > >> What are you using as CFLAGS? As both typenames should be normally > >> set, what about initializing those fields with NULL and add an > >> assertion like the attached? > > > > Actually, my compiler was right -- this was an ancient bug I introduced > > in 9.5 (commit a61fd533), and this new warning was my compiler being a > > bit smarter now for some reason. The problem is we were trying to > > extract String value from a TypeName node, which obviously doesn't work > > very well. > > > > I pushed a real fix, not just a compiler-silencer, along with a few > > lines in object_address.sql to make sure it works properly. Maybe we > > need a few more tests cases for other parts of pg_get_object_address. > > > > Pushed fix, backpatched to 9.5. > > I am now seeing the warnings that Michael was reporting *after* your > commit in 9.5 and 9.6. Do you mean the ones I reported? I don't get anything with my compiler (gcc (Debian 4.9.2-10) 4.9.2) and I don't see anything in the few logs I looked at (clang, 9.6) from buildfarm either. What are you seeing specifically? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referring toobjects
From
Peter Eisentraut
Date:
On 3/17/17 11:06, Alvaro Herrera wrote: > I don't get anything with my compiler (gcc (Debian 4.9.2-10) 4.9.2) and > I don't see anything in the few logs I looked at (clang, 9.6) from > buildfarm either. What are you seeing specifically? cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -I../../../src/include -D_FORTIFY_SOURCE=2 -DLINUX_OOM_ADJ -D_GNU_SOURCE -I/usr/include/libxml2 -c -o objectaddress.o objectaddress.c objectaddress.c: In function ‘get_object_address’: objectaddress.c:1650:24: warning: ‘typeoids[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized] objectaddress.c:1582:6: note: ‘typeoids[1]’ was declared here objectaddress.c:1627:43: warning: ‘typenames[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized] objectaddress.c:1581:12: note: ‘typenames[1]’ was declared here objectaddress.c:1650:24: warning: ‘typeoids[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized] objectaddress.c:1582:6: note: ‘typeoids[0]’ was declared here objectaddress.c:1627:43: warning: ‘typenames[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized] objectaddress.c:1581:12: note: ‘typenames[0]’ was declared here cc (Debian 4.7.2-5) 4.7.2 -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referringto objects
From
Alvaro Herrera
Date:
Peter Eisentraut wrote: > cc -Wall -Wmissing-prototypes -Wpointer-arith > -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute > -Wformat-security -fno-strict-aliasing -fwrapv > -fexcess-precision=standard -g -O2 -I../../../src/include > -D_FORTIFY_SOURCE=2 -DLINUX_OOM_ADJ -D_GNU_SOURCE -I/usr/include/libxml2 > -c -o objectaddress.o objectaddress.c > objectaddress.c: In function ‘get_object_address’: > objectaddress.c:1650:24: warning: ‘typeoids[1]’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > objectaddress.c:1582:6: note: ‘typeoids[1]’ was declared here > objectaddress.c:1627:43: warning: ‘typenames[1]’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > objectaddress.c:1581:12: note: ‘typenames[1]’ was declared here > objectaddress.c:1650:24: warning: ‘typeoids[0]’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > objectaddress.c:1582:6: note: ‘typeoids[0]’ was declared here > objectaddress.c:1627:43: warning: ‘typenames[0]’ may be used > uninitialized in this function [-Wmaybe-uninitialized] > objectaddress.c:1581:12: note: ‘typenames[0]’ was declared here > > cc (Debian 4.7.2-5) 4.7.2 Oh yeah, buildfarm member sitella shows that. Does the attached patch fix it? (pretty much the same thing Michael attached, but we also need to handle typeoids) -- Álvaro Herrera https://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
Attachment
[HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referring toobjects
From
Peter Eisentraut
Date:
On 3/17/17 13:39, Alvaro Herrera wrote: > Oh yeah, buildfarm member sitella shows that. Does the attached patch > fix it? (pretty much the same thing Michael attached, but we also need > to handle typeoids) Yes, that makes the warning go away. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services