From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8131 invoked by alias); 24 Jan 2002 01:21:06 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 8047 invoked from network); 24 Jan 2002 01:21:04 -0000 Received: from unknown (HELO dberlin.org) (64.246.6.106) by sources.redhat.com with SMTP; 24 Jan 2002 01:21:04 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by dberlin.org (8.11.6/8.11.6) with ESMTP id g0O1Kwn20889; Wed, 23 Jan 2002 20:20:58 -0500 Date: Wed, 23 Jan 2002 18:27:00 -0000 From: Daniel Berlin To: Dan Nicolaescu cc: gcc@gcc.gnu.org Subject: Re: g++ and aliasing bools In-Reply-To: <200201231638.aa22100@gremlin-relay.ics.uci.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-01/txt/msg01489.txt.bz2 On Wed, 23 Jan 2002, Dan Nicolaescu wrote: > > It looks like g++ has some problems with aliasing bools, and gcc > doesn't. It's a side effect of C++ not making alias sets for classes, i think. Try commenting out the AGGREGATE_TYPE_P check in cxx_get_alias_set and see if it goes away. > > > The following program: > > #ifdef __cplusplus > > struct bool_struct > { > bool f0; > bool f1; > bool f2; > bool f3; > }; > #else > struct bool_struct > { > _Bool f0; > _Bool f1; > _Bool f2; > _Bool f3; > }; > > #endif > > > struct bool_struct *str; > > > void > g (void) > { > str->f0 = 1; > str->f1 = 0; > str->f2 = 1; > str->f3 = 0; > } > > compiles to: > > _Z1gv: > .LLFB1: > !#PROLOGUE# 0 > !#PROLOGUE# 1 > sethi %hi(str), %o2 > ld [%o2+%lo(str)], %o1 > mov 1, %o3 > stb %o3, [%o1] > ld [%o2+%lo(str)], %o0 <- this load is not needed > stb %g0, [%o0+1] > ld [%o2+%lo(str)], %o1 <- this load is not needed > stb %o3, [%o1+2] > ld [%o2+%lo(str)], %o0 <- this load is not needed > retl > stb %g0, [%o0+3] > > when compiled with g++ -O2 on sparc-sun-solaris2.8 using a GCC from > CVS as of this morning. > > but the code is much better when compiling with gcc -O2 > > g: > !#PROLOGUE# 0 > !#PROLOGUE# 1 > sethi %hi(str), %o0 > ld [%o0+%lo(str)], %o1 > mov 1, %o2 > stb %o2, [%o1+2] > stb %g0, [%o1+3] > stb %o2, [%o1] > retl > stb %g0, [%o1+1] > > > so it looks like g++ has some issues with aliasing bools. > > Any idea what is wrong? > > >