Patchwork Disable -mpreferred-stack-boundary tests for SEH

login
register
mail settings
Submitter Richard Henderson
Date Nov. 1, 2010, 1:18 a.m.
Message ID <4CCE1580.2020100@redhat.com>
Download mbox | patch
Permalink /patch/69743/
State New
Headers show

Comments

Richard Henderson - Nov. 1, 2010, 1:18 a.m.
The previously posted patch disabled the switches in the compiler,
but I missed including the testsuite changes at the same time.


r~
* lib/target-supports.exp
	(check_effective_target_automatic_stack_alignment): True for
	x86 but not windows.
	* g++.dg/torture/stackalign/stackalign.exp: Use it to protect
	use of the preferred-stack-boundary arguments.
	* gcc.dg/torture/stackalign/stackalign.exp: Likewise.

Patch

diff --git a/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
index bfa413e..e68337d 100644
--- a/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
+++ b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
@@ -18,19 +18,15 @@ 
 # This harness is for tests that should be run at all optimisation levels.
 
 load_lib g++-dg.exp
-
-# Only run on targets which support automatic stack alignment.
-if { ![check_effective_target_automatic_stack_alignment] } then {
-    return
-}
-
+dg-init
 set additional_flags ""
-if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+
+# If automatic stack alignment is supported, force it on.
+if { [check_effective_target_automatic_stack_alignment] } then {
     lappend additional_flags "-mstackrealign"
     lappend additional_flags "-mpreferred-stack-boundary=5"
 }
 
-dg-init
 gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] $additional_flags
 if { [check_effective_target_fpic] } then {
     lappend additional_flags "-fpic"
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
index ef45dbe..83c6239 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
@@ -19,15 +19,12 @@ 
 
 load_lib gcc-dg.exp
 
-# Only run on targets which support automatic stack alignment.
-if { ![check_effective_target_automatic_stack_alignment] } then {
-    return
-}
-
 set additional_flags ""
-if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+if { [check_effective_target_automatic_stack_alignment] } then {
     lappend additional_flags "-mstackrealign"
     lappend additional_flags "-mpreferred-stack-boundary=5"
+}
+if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
     lappend additional_flags "-mno-mmx"
 }
 
@@ -40,7 +37,7 @@  if { [check_effective_target_fpic] } then {
     gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $pic_additional_flags
 }
 
-if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+if { [check_effective_target_automatic_stack_alignment] } then {
     lappend additional_flags "-mforce-drap"
     gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] $additional_flags
     if { [check_effective_target_fpic] } then {
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0ae003a..87b234d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3551,8 +3551,15 @@  proc check_effective_target_4byte_wchar_t { } {
 # Return 1 if the target supports automatic stack alignment.
 
 proc check_effective_target_automatic_stack_alignment  { } {
-    # Not "stack alignment" per se, but proper stack alignment of decls.
-    return 1;
+    # Ordinarily x86 supports automatic stack alignment ...
+    if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
+        if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
+	    # ... except Win64 SEH doesn't.  Succeed for Win32 though.
+	    return [check_effective_target_ilp32];
+	}
+	return 1;
+    }
+    return 0;
 }
 
 # Return 1 if avx instructions can be compiled.