From d7e739a96b39007252f66f0892c1bbb276aa3700 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 14 Oct 2008 13:16:03 +0000 Subject: 2008-10-14 Joel Sherrill * malloctest/init.c: Do not generate alignment factors larger that will not fit in a native integer. --- testsuites/libtests/ChangeLog | 5 +++++ testsuites/libtests/malloctest/init.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'testsuites/libtests') diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index 38d33262d9..2e99ffbcba 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,8 @@ +2008-10-14 Joel Sherrill + + * malloctest/init.c: Do not generate alignment factors larger that will + not fit in a native integer. + 2008-09-17 Joel Sherrill * stackchk/system.h: Rename STACK_CHECKER_ON to more appropriate diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c index b1028640b4..db973e2377 100644 --- a/testsuites/libtests/malloctest/init.c +++ b/testsuites/libtests/malloctest/init.c @@ -26,6 +26,7 @@ #include "system.h" #include +#include #include #include @@ -227,6 +228,7 @@ void test_posix_memalign(void) void *p1, *p2; int i; int sc; + int maximumShift; puts( "posix_memalign - NULL return pointer -- EINVAL" ); sc = posix_memalign( NULL, 32, 8 ); @@ -240,8 +242,17 @@ void test_posix_memalign(void) sc = posix_memalign( &p1, 2, 8 ); fatal_posix_service_status( sc, EINVAL, "posix_memalign alignment of 2" ); - for ( i=2 ; i<32 ; i++ ) { - printf( "posix_memalign - alignment of %d -- OK\n", 1 << i ); + if ( sizeof(int) == 4 ) + maximumShift = 31; + else if ( sizeof(int) == 2 ) + maximumShift = 15; + else { + printf( "Unsupported int size == %d\n", sizeof(int) ); + rtems_test_exit(0); + } + for ( i=2 ; i