This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix g++.brendan/new2.C
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 7 Feb 2002 13:50:40 -0800
- Subject: fix g++.brendan/new2.C
This test was generating unaligned accesses on Alpha. The
block of characters being used was not sufficiently aligned.
r~
* g++.old-deja/g++.brendan/new2.C: Arrange for allocated memory
to be sufficiently aligned for integers.
Index: g++.old-deja/g++.brendan/new2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.brendan/new2.C,v
retrieving revision 1.5
diff -c -p -d -r1.5 new2.C
*** new2.C 2001/02/14 21:42:30 1.5
--- new2.C 2002/02/07 21:47:38
*************** int main ()
*** 48,55 ****
return 0;
}
! char allocation_space[1000];
! char* allocation_ptr = allocation_space;
void base::operator delete (void* p)
{
--- 48,55 ----
return 0;
}
! int allocation_space[100];
! int* allocation_ptr = allocation_space;
void base::operator delete (void* p)
{
*************** void base::operator delete (void* p)
*** 57,67 ****
void *base::operator new (size_t size)
{
! char* return_value = allocation_ptr;
new_call_count++;
if (size != expected_size)
errors++;
! allocation_ptr = allocation_ptr + size;
return (void*) return_value;
}
--- 57,67 ----
void *base::operator new (size_t size)
{
! int* return_value = allocation_ptr;
new_call_count++;
if (size != expected_size)
errors++;
! allocation_ptr += (size + sizeof(int) - 1) / sizeof(int);
return (void*) return_value;
}