public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: sje@cup.hp.com To: gcc-gnats@gcc.gnu.org Subject: c++/6685: g++ sets REG_POINTER for variables that contain offsets and not real pointers Date: Thu, 16 May 2002 14:16:00 -0000 [thread overview] Message-ID: <20020516211302.20252.qmail@sources.redhat.com> (raw) >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 <stdio.h> 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); }
reply other threads:[~2002-05-16 21:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020516211302.20252.qmail@sources.redhat.com \ --to=sje@cup.hp.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).