From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5034 invoked by alias); 22 May 2008 14:32:32 -0000 Received: (qmail 5022 invoked by uid 22791); 22 May 2008 14:32:31 -0000 X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 22 May 2008 14:32:12 +0000 Received: from Relay1.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 44F8E41599 for ; Thu, 22 May 2008 16:32:09 +0200 (CEST) Date: Thu, 22 May 2008 16:55:00 -0000 From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] New testcase Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg01387.txt.bz2 While trying to work on PR36291. Committed as obvious. Richard. 2008-05-22 Richard Guenther * gcc.c-torture/execute/20080522-1.c: New testcase. Index: testsuite/gcc.c-torture/execute/20080522-1.c =================================================================== --- testsuite/gcc.c-torture/execute/20080522-1.c (revision 0) +++ testsuite/gcc.c-torture/execute/20080522-1.c (revision 0) @@ -0,0 +1,43 @@ +/* This testcase is to make sure we have i in referenced vars and that we + properly compute aliasing for the loads and stores. */ + +extern void abort (void); + +static int i; +static int *p = &i; + +int __attribute__((noinline)) +foo(int *q) +{ + *p = 1; + *q = 2; + return *p; +} + +int __attribute__((noinline)) +bar(int *q) +{ + *q = 2; + *p = 1; + return *q; +} + +int main() +{ + int j = 0; + + if (foo(&i) != 2) + abort (); + if (bar(&i) != 1) + abort (); + if (foo(&j) != 1) + abort (); + if (j != 2) + abort (); + if (bar(&j) != 2) + abort (); + if (j != 2) + abort (); + + return 0; +}