Re: more compile warnings

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Joe Conway" <mail(at)joeconway(dot)com>
Cc: <rbt(at)zort(dot)ca>, "PostgreSQL-development" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: more compile warnings
Date: 2002-12-07 04:10:20
Message-ID: D90A5A6C612A39408103E6ECDD77B8294089F9@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> Sent: Friday, December 06, 2002 7:58 PM
> To: Joe Conway
> Cc: rbt(at)zort(dot)ca; PostgreSQL-development
> Subject: Re: [HACKERS] more compile warnings
>
>
> Rod, can you comment on these warnings Joe Conway's compiler
> is showing? I don't see the warnings with gcc, but clearly
> they look like problems.
>
> I can just assign a NULL on definition, but I thought you
> should take a look.
>
> --------------------------------------------------------------
> -------------
>
> Joe Conway wrote:
> > Hi Bruce,
> >
> > I just sync'd up/make clean/make all and get this:
> >
> > gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations
> > -I../../../src/include -c -o typecmds.o typecmds.c -MMD
> > typecmds.c: In function `AlterDomainAddConstraint':
> > typecmds.c:1237: warning: `ccbin' might be used
> uninitialized in this
> > function
> > typecmds.c: In function `get_rels_with_domain':
> > typecmds.c:1450: warning: `rtc' might be used uninitialized
> in this function

Instead of just assigning a value, it means it is conceivable that a
path allows undefined behavior. Example:

...
int y;
if (x < 5)
y = 3;
if (x > 5)
y = 1;

What happens if x == 5? Then y is indeterminate.

Sometimes, the flow analysis just gets confused and it really will be
initialized along every path. But at least it bears checking. Hence
the warning.

I like to use -W -Wall -ansi -pedantic -O3

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-12-07 04:16:30 Re: more compile warnings
Previous Message Bruce Momjian 2002-12-07 04:06:43 Re: IPv6 patch rejected