From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2041 invoked by alias); 10 Aug 2002 11:56:00 -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 2022 invoked by uid 71); 10 Aug 2002 11:56:00 -0000 Date: Sat, 10 Aug 2002 06:16:00 -0000 Message-ID: <20020810115600.2021.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Gwenole Beauchesne Subject: Re: target/7559: kdelibs miscompilation Reply-To: Gwenole Beauchesne X-SW-Source: 2002-08/txt/msg00210.txt.bz2 List-Id: The following reply was made to PR target/7559; it has been noted by GNATS. From: Gwenole Beauchesne To: gcc-gnats@gcc.gnu.org Cc: david@mandrakesoft.com, , , , , Subject: Re: target/7559: kdelibs miscompilation Date: Sat, 10 Aug 2002 13:54:00 +0200 (CEST) > The following C testcase is equivalent in miscompiled-behavior. If you > don't want to bother compiling the C++ front-end for tests. ;-) This could be a mis-classification of the other eightbyte sub-object. 1) Actually, the following testcase fails too and occurs because we have a two eightbytes object, "sliced" in the middle (aka two sub-aggregates). As a result, only the first eightbyte is actually passed in register. The other one vanished. [gb@gauss vrac]$ cat struct.c extern void abort(); struct A { int x, y; }; struct R { struct A a, b; }; struct R R = { { 100, 100 }, { 200, 200 } }; void f(struct R r) { if (r.a.x != R.a.x || r.a.y != R.a.y || r.b.x != R.b.x || r.b.y != R.b.y) abort(); } int main() { f(R); return 0; } 2) The following testcase *won't* fail though we have a two eightbytes object, and is not "sliced" in. [gb@gauss vrac]$ cat other.c extern void abort(); struct A { int a, b, c, d; }; struct A X = { 100, 200, 300, 400 }; void f(struct A x) { if (x.a != X.a || x.b != X.b || x.c != X.c || x.d != X.d) abort(); } int main(void) { f(X); return 0; } 3) The last testcase is ultra-reduced to a two eightbytes object, with only one member in each one. That one do fails. extern void abort(); struct A { long x; }; struct R { struct A a, b; }; struct R R = { 100, 200 }; void f(struct R r) { if (r.a.x != R.a.x || r.b.x != R.b.x) abort(); } int main() { f(R); return 0; } 4) The testcase won't fail if we add some garbage in struct R, because the size of the object will be > 16 bytes, thus having MEMORY class. HTH, Gwenole.