This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ptrmem.C conflict with PSImode pointers
- To: gcc-patches at gcc dot gnu dot org
- Subject: ptrmem.C conflict with PSImode pointers
- From: Joern Rennecke <amylaar at cambridge dot redhat dot com>
- Date: Wed, 28 Feb 2001 23:36:52 +0000 (GMT)
- Cc: amylaar at cambridge dot redhat dot com
gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C has some code that checks
if a pointer value is -1. That does not work on systems with
PSImode pointers (unless you got just the right kind of sign extension).
We should really only compare those bits of the pointer that are relevant.
I think it is simplest if the target just sets an extra macro,
__POINTER_MASK__, to a bitmask to mask out any bits that are not used in
pointers; this can be done in dejagnu/baseboards/<target>.exp, e.g. for
24 bit pointers:
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags] -D__PO
INTER_MASK__=0xffffff"
Still, this macro has to be used in the test to be useful:
Fri Feb 9 05:30:47 2001 J"orn Rennecke <amylaar@redhat.com>
* g++.old-deja/g++.abi/ptrmem.C (main): Use __POINTER_MASK__.
Index: g++.old-deja/g++.abi/ptrmem.C
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C,v
retrieving revision 1.4
retrieving revision 1.4.68.1
diff -p -r1.4 -r1.4.68.1
*** ptrmem.C 2000/07/14 17:51:24 1.4
--- ptrmem.C 2001/02/09 05:38:42 1.4.68.1
*************** main ()
*** 109,115 ****
--- 109,119 ----
if ((char *) &s.j - (char *) &s != *((ptrdiff_t *) &z))
return 15;
z = 0;
+ #ifdef __POINTER_MASK__
+ if ((*((ptrdiff_t *) &z) ^ -1) & __POINTER_MASK__)
+ #else
if (*((ptrdiff_t *) &z) != -1)
+ #endif
return 16;
}