From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12219 invoked by alias); 25 Apr 2002 16:19:44 -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 11582 invoked from network); 25 Apr 2002 16:18:27 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 25 Apr 2002 16:18:27 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id g3PGINFN009882; Thu, 25 Apr 2002 12:18:23 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g3PGIMNq009881; Thu, 25 Apr 2002 12:18:22 -0400 (EDT) Message-Id: <200204251618.g3PGIMNq009881@hiauly1.hia.nrc.ca> Subject: Re: PA specifies invalid T_ADAFLAGS To: hainque@ACT-Europe.FR (Olivier Hainque) Date: Thu, 25 Apr 2002 09:25:00 -0000 From: "John David Anglin" Cc: gcc@gcc.gnu.org In-Reply-To: from "Olivier Hainque" at Apr 25, 2002 11:13:24 am MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg01325.txt.bz2 > "John David Anglin" writes: > > > Has the PA indexing situation been reviewed since the above patch was > > installed? > > Perhaps a testcase exercised against the current 3.1 would help ... > > IIUC, some constructs we have in Ada basically amount to the following kind of > behavior in C: > > > #include > > int lo () > { > return 60000; > } > > int > main () > { > volatile char c; > > char * b = malloc (15); > char * vb = b - lo(); > > c = vb [lo()]; > > return 0; > } [...] > bl lo,%r2 > copy %r28,%r4 > .CALL > bl lo,%r2 > sub %r4,%r28,%r4 > ldbx %r28(%r4),%r4 <=== Runtime fault here > stb %r4,-120(%r30) > > > This dumps core at the ldbx point because the space check is performed > against r28 and not r28+r4. I note that there is still confusion about space register usage and the PA hpux runtime. The ldbx instruction is short for ldbx %r28(%sr4,%r4),%r4 The space check is done using %r4 against %sr4. When the space check is against %sr4, the two most significant bits select one of %sr4, %sr5, %sr6, or %sr7 to build the final physical address. In this runtime model, %sr0, %sr1, %sr2 and %sr3 are only used in special cases and never for data loads. The example is not legal C. However, it will work under hpux if you keep the base in the same segment as the data. Under linux, %sr4, %sr5, %sr6, and %sr7 are all the same, so you don't need to worry which register gets selected. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605)