Peter Eisentraut wrote:
A simple test shows that this is not the case, even with lots of -W options.

Right -- AFAICS we only get the following warnings of this class with GCC 4.0 on current sources:

% gcc --version
gcc-4.0 (GCC) 4.0.1 20050701 (prerelease) (Debian 4.0.0-12)
[...]
% make -s clean all
[...]
In file included from /home/neilc/pgsql/src/backend/regex/regexec.c:1070:
/home/neilc/pgsql/src/backend/regex/rege_dfa.c: In function 'getvacant':
/home/neilc/pgsql/src/backend/regex/rege_dfa.c:581: warning: 'lastap.ss' may be used uninitialized in this function /home/neilc/pgsql/src/backend/regex/rege_dfa.c:581: warning: 'lastap.co' may be used uninitialized in this function

/home/neilc/pgsql/src/backend/utils/adt/inet_net_ntop.c: In function 'inet_net_ntop_ipv6': /home/neilc/pgsql/src/backend/utils/adt/inet_net_ntop.c:427: warning: 'cur.len' may be used uninitialized in this function /home/neilc/pgsql/src/backend/utils/adt/inet_net_ntop.c:427: warning: 'best.len' may be used uninitialized in this function

/home/neilc/pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c: In function 'PGTYPESdate_defmt_asc': /home/neilc/pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c:335: warning: 'tm.tm_mday' may be used uninitialized in this function /home/neilc/pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c:335: warning: 'tm.tm_mon' may be used uninitialized in this function /home/neilc/pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c:335: warning: 'tm.tm_year' may be used uninitialized in this function

/home/neilc/pgsql/src/pl/plpgsql/src/pl_comp.c: In function 'plpgsql_parse_tripwordtype': /home/neilc/pgsql/src/pl/plpgsql/src/pl_comp.c:1372: warning: 'cp[0]' may be used uninitialized in this function /home/neilc/pgsql/src/pl/plpgsql/src/pl_comp.c:1372: warning: 'cp[1]' may be used uninitialized in this function

(Plus many errors regarding signedness, which is a separate matter.)

All these warnings like somewhat reasonable, AFAICS: while the code may actually always initialize the variables before using them, it's understandable that the compiler can't infer this automatically. And this is surely a tiny fraction of the changes that would be required if something as fundamental as initialization via out parameters was broken.

-Neil

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to