Re: more compile warnings

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: more compile warnings
Дата
Msg-id 200212070416.gB74GUD19290@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: more compile warnings  ("Dann Corbit" <DCorbit@connx.com>)
Ответы Re: more compile warnings  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
Re: more compile warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Dann Corbit"
Дата:
Сообщение: Re: more compile warnings
Следующее
От: "Jeroen T. Vermeulen"
Дата:
Сообщение: Re: more compile warnings