Re: compile warning - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: compile warning
Date
Msg-id 20031010043731.GA24655@dcc.uchile.cl
Whole thread Raw
In response to Re: compile warning  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: compile warning  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Thu, Oct 09, 2003 at 11:51:09PM -0400, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > I'm seeing this compile warning on today's CVS tip:
> > 
> > $ make src/backend/commands/tablecmds.o
> > gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations -I./src/include -D_GNU_SOURCE   -c -o
src/backend/commands/tablecmds.osrc/backend/commands/tablecmds.c
 
> > src/backend/commands/tablecmds.c: In function `validateForeignKeyConstraint':
> > src/backend/commands/tablecmds.c:3528: warning: dereferencing type-punned pointer will break strict-aliasing rules
> 
> If you change the offending line to:
> 
>     fcinfo.context = (struct Node *) &trigdata;
> 
> I know it shouldn't make a difference, but it is worth a try.

Nope, same warning.  I don't know what it means though.  I tried some
other things to correct it, but I can't find exactly what it's
complaining about.  What is a "type-punned pointer"?

Looking in Google finds this thread first:
http://www.mail-archive.com/freebsd-current@freebsd.org/msg58957.html
which is full of a very ugly kernel macro (I'm happy to stay away from
that):

http://www.mail-archive.com/freebsd-current@freebsd.org/msg58957.html


This other guy actually posted an useful excerpt from the GCC manpage:
http://www.ethereal.com/lists/ethereal-dev/200309/msg00342.html

So, I still don't understand what's the noise about.  However I think
there's no way to silence the warning without uglifying the structs a
lot by means of some union.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I would rather have GNU than GNOT."  (ccchips, lwn.net/Articles/37595/)


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: CREATE USER bug
Next
From: Curt Sampson
Date:
Subject: 7.4beta4 compile failure on NetBSD