Saurabh Verma <[EMAIL PROTECTED]> writes: > i had a query regarding testcase gcc.c-torture/execute/960521-1.c [Link > below]. The testcase does the following: > i) mallocs two integer arrays a and b of size n each > ii) *b=0 and increment b > {lets call the new b as bnew, and the old b as bold, so > that bnew = bold+1,and bold[0]=bnew[-1]=0 } > iii) sets a[0] to a[n-1] to -1 > iv) sets bnew[0] to bnew[BLOCK_SIZE-2] to -1 > => bold [1] to bold [BLOCK_SIZE-1] to -1 > v) results in PASS if bnew [-1] {i.e. bold[0]} is still zero > FAILs otherwise > > Now this test fails for a particular architecture, because on of the > mallocs returned zero (the amount of stack and heap available being 65K > and 20K respectively). This is because the testcase decides the size to > be malloc'ed based on the stack available. Since the heap space > available to me is much smaller than the stack, this calculation ( size > of each array = (STACK_SIZE / (sizeof (*a) + sizeof (*b)))) results in > an impossibly large malloc request, and the array value setting > overwrites the text. > > Before making any changes to the testcase to adapt it to our > requirements, i wanted to be sure about the reason for the test, i.e. > what exactly is the testcase supposed to check for? This is a very old > testcase and a look at viewcvs shows it as an initial import from egcs > testsuite base.
I would assume that the test is for some sort of loop optimization. But the case of heapsize << stacksize is rather unusual, so I think the simplest thing would be for you to just xfail the test on your target by creating a 960521-1.x file. I wouldn't worry about whether your target has some bug that will fail the test--the test was almost certainly designed to test target independent code. Ian