This is the mail archive of the gcc-patches@gcc.gnu.org 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] |
| Other format: | [Raw text] | |
The attached patch addresses an issue when testing
gcc.c-torture/execute/multi-ix.c with STACK_SIZE defined. The easiest
way to describe the problem is to cut-and-paste a bit of multi-ix.c:
typedef int l[CHUNK];
void
f (int n)
{
int i;
l a0, a1, a2, a3, a4, a5, a6, a7, a8, a9;
l a10, a11, a12, a13, a14, a15, a16, a17, a18, a19;
l a20, a21, a22, a23, a24, a25, a26, a27, a28, a29;
l a30, a31, a32, a33, a34, a35, a36, a37, a38, a39;
int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
int i10, i11, i12, i13, i14, i15, i16, i17, i18, i19;
int i20, i21, i22, i23, i24, i25, i26, i27, i28, i29;
int i30, i31, i32, i33, i34, i35, i36, i37, i38, i39;
...
...call a couple varargs functions, passing ~40 parameters...
}
'f' is going to need sizeof(int)*(41+CHUNK) bytes of stack space for its
temporary variables alone, plus register saves and other bits, plus
space to call out to the varargs functions.
The testcase contains a bit of logic to determine an appropriate size
for CHUNK in case STACK_SIZE is defined, thereby limiting the amount of
stack space 'f' needs. Unfortunately, the computation of CHUNK is not
conservative enough--it only considered the space for integer
temporaries (and was not conservative even there). Therefore, if
STACK_SIZE was defined and we execute the testcase in an environment
with that fixed amount of stack space, the testcase will fail with a
segmentation violation.
The patch changes things to be a bit more precise in accounting for the
space required by the 'int' temporaries and the varargs callouts. It's
possible there are platforms for which even these settings are not
conservative enough, but this is at least an improvement on what was
there before.
Tested on {i586,ppc,sparc}-wrs-vxworks with STACK_SIZE defined to be
192k, where this test used to fail and now passes. OK to commit?
-Nathan
2007-06-30 Nathan Froyd <froydnj@codesourcery.com>
gcc/testsuite/
* gcc.c-torture/execute/multi-ix.c (CHUNK): Be more conservative
about the chunk size when STACK_SIZE is defined.
Attachment:
multi-ix.patch
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |