Re: fix for strict-alias warnings - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: fix for strict-alias warnings
Date
Msg-id 200310111955.h9BJtMK10256@candle.pha.pa.us
Whole thread Raw
In response to Re: fix for strict-alias warnings  ("Andrew Dunstan" <andrew@dunslane.net>)
List pgsql-patches
Andrew Dunstan wrote:
> >   The proc.c cases were using MemSet, which was checking if the
> > int* as aligned for int* access.  In fact, we could change MemSet to
> > always take a void *, and do the int* casting when we access it after
> > testing for alignment.
> >
>
> Since MemSet is generic, that is probably a good idea.

I have applied the following patch to add an additional void* cast to
MemSet, and added a comment that this was safe because alignment is
checked below --- patch attached.

--
  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, Pennsylvania 19073
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/c.h,v
retrieving revision 1.153
diff -c -c -r1.153 c.h
*** src/include/c.h    21 Sep 2003 17:57:21 -0000    1.153
--- src/include/c.h    11 Oct 2003 19:51:09 -0000
***************
*** 604,610 ****
  #define MemSet(start, val, len) \
      do \
      { \
!         int32 * _start = (int32 *) (start); \
          int        _val = (val); \
          Size    _len = (len); \
  \
--- 604,611 ----
  #define MemSet(start, val, len) \
      do \
      { \
!         /* (void *) used because we check for alignment below */ \
!         int32 * _start = (int32 *) (void *) (start); \
          int        _val = (val); \
          Size    _len = (len); \
  \

pgsql-patches by date:

Previous
From: "Andrew Dunstan"
Date:
Subject: Re: fix for strict-alias warnings
Next
From: "veramente@libero.it"
Date:
Subject: libpq Italian Version first translation