Skip site navigation (1) Skip section navigation (2)

GCC pointer signedness (and other) warnings

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: GCC pointer signedness (and other) warnings
Date: 2005-06-27 20:27:43
Message-ID: 37D5E361-2A95-4D62-88FF-46CB423FB502@myrealbox.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I've noticed a lot of signedness warnings when compiling Postgres  
with GCC 4. They may have been there with GCC 3.3 as well, but I  
don't recall. Here's a example:

gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith - 
Wdeclaration-after-statement -Wold-style-definition -Wendif-labels - 
fno-strict-aliasing -g -I../../../src/include -I/usr/include/  -c -o  
pg_proc.o pg_proc.c
pg_proc.c: In function 'match_prosrc_to_query':
pg_proc.c:724: warning: pointer targets in passing argument 1 of  
'pg_mbstrlen_with_len' differ in signedness
pg_proc.c:738: warning: pointer targets in passing argument 1 of  
'pg_mbstrlen_with_len' differ in signedness

Here's another:
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith - 
Wdeclaration-after-statement -Wold-style-definition -Wendif-labels - 
fno-strict-aliasing -g  -I../../../../../../src/include -I/usr/ 
include/  -c -o utf8_and_ascii.o utf8_and_ascii.c
utf8_and_ascii.c: In function 'ascii_to_utf8':
utf8_and_ascii.c:38: warning: pointer targets in initialization  
differ in signedness
utf8_and_ascii.c:39: warning: pointer targets in initialization  
differ in signedness


I've also noticed some possible uninitialized variable warnings, such  
as this:
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith - 
Wdeclaration-after-statement -Wold-style-definition -Wendif-labels - 
fno-strict-aliasing -g  -I../../../../src/interfaces/ecpg/include - 
I../../../../src/include/utils -I../../../../src/interfaces/libpq - 
I../../../../src/include -I/usr/include/  -DFRONTEND  -c -o  
datetime.o datetime.c
datetime.c: In function 'PGTYPESdate_defmt_asc':
datetime.c:335: warning: 'tm$tm_mday' may be used uninitialized in  
this function
datetime.c:335: warning: 'tm$tm_mon' may be used uninitialized in  
this function
datetime.c:335: warning: 'tm$tm_year' may be used uninitialized in  
this function

Are these things we could clean up? (Yes, I'm volunteering if it's  
something I'm capable of helping out with, though probably not for 8.1.)

Michael Glaesemann
grzm myrealbox com


laughter:~ glaesema$ gcc -v
Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs
Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure -- 
disable-checking --prefix=/usr --mandir=/share/man --enable- 
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/ 
s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ -- 
build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 -- 
target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)


pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2005-06-27 20:54:26
Subject: Wierd panic with 7.4.7
Previous:From: Jim C. NasbyDate: 2005-06-27 19:50:55
Subject: Re: Problem with dblink regression test

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group