Re: compile warning

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: compile warning
Date: 2003-10-10 04:37:31
Message-ID: 20031010043731.GA24655@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.o src/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(at)freebsd(dot)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(at)freebsd(dot)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/)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2003-10-10 05:39:23 Re: 2-phase commit
Previous Message Neil Conway 2003-10-10 04:26:40 Re: CREATE USER bug