Committed: fix MMIX LTO gcc.dg/torture/stackalign/builtin-return-1.c
diff mbox

Message ID
State New
Headers show

Commit Message

Hans-Peter Nilsson June 7, 2014, 12:04 a.m. UTC
Apparently LTO improved or at least changed between r210000 and
r211121, such that memory outside the defined space was wrongly read
as "expected" for this test-case, corresponding to the wrongly
presumed stacked parameters.  For a "normal" target this would
correspond to a SEGV.  You'd need the memory-strictness change file (a
sort-of CWEB patch) from
<> to see this
when testing with the mmixware mmix simulator:

Running /home/hp/gcctop/tmp/mbase1/gcc/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp ...
FAIL: gcc.dg/torture/stackalign/builtin-return-1.c  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test

and in gcc.log:
spawn mmix ./builtin-return-1.exe
         1. 00000000000003ec: 8d10fd20 (LDOI) $16=l[25] = M8[#16809fffffffffe0+32] = 0
  198 instructions, 49 mems, 236 oops; 4 good guesses, 7 bad
  (now at location #00000000000003f0)

(for the default Knuth ABI; but the error for the GNU ABI is similar)

This also annotates as fixed an age-old PR, though test has actually
been passing for some time after "Tue Nov 9 00:36:20 UTC 2004" (yes,
this was CVS time) and up-to-and-including at least r210000.  I wrote
this fix when investigating fallout from the memory-strictness feature
mentioned above, but as this test didn't fail at that time, I didn't
apply it.


	PR target/18343
	* gcc.dg/torture/stackalign/builtin-return-1.c (STACK_ARGUMENTS_SIZE):
	New macro, 0 for __MMIX__, default 64.
	(bar): Pass it to __builtin_apply instead of literal 64.

brgds, H-P

diff mbox

Index: gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
--- gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c	(revision 211328)
+++ gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c	(working copy)
@@ -5,6 +5,13 @@ 
 /* This used to fail on SPARC because the (undefined) return
    value of 'bar' was overwriting that of 'foo'.  */

+#ifdef __MMIX__
+/* No parameters on stack for bar.  */
 extern void abort(void);

 int foo(int n)
@@ -14,7 +21,8 @@  int foo(int n)

 int bar(int n)
-  __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
+  __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(),

 char *g;