public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6685: g++ sets REG_POINTER for variables that contain offsets and not real pointers
@ 2002-05-16 14:16 sje
0 siblings, 0 replies; only message in thread
From: sje @ 2002-05-16 14:16 UTC (permalink / raw)
To: gcc-gnats
>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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-05-16 21:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16 14:16 c++/6685: g++ sets REG_POINTER for variables that contain offsets and not real pointers sje
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).