This is the mail archive of the 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]

ptrmem.C conflict with PSImode pointers

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

Still, this macro has to be used in the test to be useful:

Fri Feb  9 05:30:47 2001  J"orn Rennecke <>

	* 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
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
*************** 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;

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