This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix aliasing warning


Hi,
this fixes the new aliasing warning that occurs during bootstrap. The system headers have two structures for register saving. On i86, one starts with something like
short ds, ds_high;
and the other starts with
struct regset gr_regs;
which itself starts with
long regs[numregs];


(I'm typing this from memory, so the names will be wrong, but you get the picture.)

This is unfortunate, and does expose aliasing issues. Luckily I think the aliasing won't bite as we don't read through one then write through the other within the same compiler visible code.

booted & tested on i686-pc-linux-gnu, ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-06-24  Nathan Sidwell  <nathan@codesourcery.com>

	* config/i386/linux-unwind.h (x86_fallback_frame_state): Disable
	aliasing warning with void * cast.

Index: config/i386/linux-unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/linux-unwind.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 linux-unwind.h
*** config/i386/linux-unwind.h	11 Feb 2005 01:12:55 -0000	1.3
--- config/i386/linux-unwind.h	27 Jun 2005 11:55:26 -0000
*************** x86_fallback_frame_state (struct _Unwind
*** 138,144 ****
  	struct siginfo info;
  	struct ucontext uc;
        } *rt_ = context->cfa;
!       sc = (struct sigcontext *) &rt_->uc.uc_mcontext;
      }
    else
      return _URC_END_OF_STACK;
--- 138,147 ----
  	struct siginfo info;
  	struct ucontext uc;
        } *rt_ = context->cfa;
!       /* The void * cast is necessary to avoid an aliasing warning.
!          The aliasing warning is correct, but should not be a problem
!          because it does not alias anything.  */
!       sc = (struct sigcontext *) (void *)&rt_->uc.uc_mcontext;
      }
    else
      return _URC_END_OF_STACK;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]