From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7095 invoked by alias); 3 May 2003 23:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 7057 invoked by uid 71); 3 May 2003 23:26:01 -0000 Date: Sat, 03 May 2003 23:26:00 -0000 Message-ID: <20030503232601.7056.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Dan Nicolaescu Subject: Re: c/2480: aliasing problem with global structures Reply-To: Dan Nicolaescu X-SW-Source: 2003-05/txt/msg00216.txt.bz2 List-Id: The following reply was made to PR c/2480; it has been noted by GNATS. From: Dan Nicolaescu To: bangerth@dealii.org Cc: gcc-gnats@gcc.gnu.org Subject: Re: c/2480: aliasing problem with global structures Date: Sat, 03 May 2003 16:18:09 -0700 With the tweaks below the code in this PR can be added to the GCC testsuite in case somebody wants to do that. /* { dg-do link } */ struct example { char a; int b; char c; } *ex1; extern void link_error(void); void bar (void) { ex1->a = 1; ex1->b = 2; ex1->c = 3; if (ex1->a != 1) link_error (); if (ex1->b != 2) link_error (); if (ex1->c != 3) link_error (); } void foo (struct example *ex2) { ex2->a = 1; ex2->b = 2; ex2->c = 3; if (ex2->a != 1) link_error (); if (ex2->b != 2) link_error (); if (ex2->c != 3) link_error (); } int main (void) { bar (); foo (ex1); return 0; }