Re: more compile warnings

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

Dann Corbit wrote:
> 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.

Yes, I looked at the code, and they are legitimate warnings.

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

I use:

-Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wcast-align

You would think that would catch it. My problem is that I am compiling
with -O0, because I compile all day and I don't care about optimization.
In this case, the -O3 is doing some optimization that catches the
problem, while -O0 does not. Interesting. Even -O catches it.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2002-12-07 04:35:11 Re: more compile warnings
Previous Message Dann Corbit 2002-12-07 04:10:20 Re: more compile warnings