This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/6685: g++ sets REG_POINTER for variables that contain offsets and not real pointers



>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);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]