From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21970 invoked by alias); 16 May 2002 21:16:06 -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 21906 invoked by uid 71); 16 May 2002 21:16:02 -0000 Resent-Date: 16 May 2002 21:16:02 -0000 Resent-Message-ID: <20020516211602.21902.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, sje@cup.hp.com Received:(qmail 20254 invoked by uid 61); 16 May 2002 21:13:02 -0000 Message-Id:<20020516211302.20252.qmail@sources.redhat.com> Date: Thu, 16 May 2002 14:16:00 -0000 From: sje@cup.hp.com Reply-To: sje@cup.hp.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/6685: g++ sets REG_POINTER for variables that contain offsets and not real pointers X-SW-Source: 2002-05/txt/msg00467.txt.bz2 List-Id: >Number: 6685 >Category: c++ >Synopsis: g++ sets REG_POINTER for variables that contain offsets and not real pointers >Confidential: no >Severity: serious >Priority: low >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu May 16 14:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: sje@cup.hp.com >Release: GCC 3.1 >Organization: >Environment: IA64 HP-UX 11.20 >Description: It is probably not possible to generate an actual error with this but it might be. HP-UX IA64 will fail on the test case, but it is not completely checked in yet. PA may show problems but not with the test case I have. If you run the testcase and examine the rtl by hand you will see that the first argument to func is marked with REG_POINTER but it is an offset and not a pointer. It later gets added to a value that is a real pointer but that value is *not* marked with REG_POINTER even though it is. This confusion is getting in the way of a platform specific IA64 optimization I want to do and could cause PA errors. You can find some more comments in the GCC mailing list starting with the mail I sent at http://gcc.gnu.org/ml/gcc/2002-05/msg01193.html >How-To-Repeat: Compile x.cc with -O1 and examine the rtl output. You should see that in0 is assigned to a reg and marked with REG_POINTER even though it is an offset and not a pointer. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="x.cc" Content-Disposition: inline; filename="x.cc" // Failed in -O1 - memory fault #include struct A { A(int arg) : ia(arg) {} int x,y,z,ia; int mf(int arg) { return arg + ia; } }; int func(int A::*pdm, int (A::*pmf)(int)) // 2. regular function { A oa(2); return ((&oa)->*pdm) + (oa.*pmf)(2); } int main() { int val; int A::*pda = &A::ia; int (A::*pmfa)(int) = &A::mf; val = func( pda, pmfa ); if(val != 6) printf("val=%d, expect 6 \n", val); }