+2017-07-06 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * doc/sourcebuild.texi (Test Directives, Variants of
+ dg-require-support): Add documentation for dg-require-stack-check.
+
2017-07-05 Sebastian Peryt <sebastian.peryt@intel.com>
* config/i386/subst.md (mask_scalar, round_scalar,
Skip the test if the target does not support profiling with option
@var{profopt}.
+@item dg-require-stack-check @var{check}
+Skip the test if the target does not support the @code{-fstack-check}
+option. If @var{check} is @code{""}, support for @code{-fstack-check}
+is checked, for @code{-fstack-check=("@var{check}")} otherwise.
+
@item dg-require-visibility @var{vis}
Skip the test if the target does not support the @code{visibility} attribute.
If @var{vis} is @code{""}, support for @code{visibility("hidden")} is
+2017-07-06 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports-dg.exp (dg-require-stack-check): New.
+ * lib/target-supports.exp (check_stack_check_available): New.
+ * g++.dg/other/i386-9.C: Add dg-require-stack-check.
+ * gcc.c-torture/compile/stack-check-1.c: Likewise.
+ * gcc.dg/graphite/run-id-pr47653.c: Likewise.
+ * gcc.dg/pr47443.c: Likewise.
+ * gcc.dg/pr48134.c: Likewise.
+ * gcc.dg/pr70017.c: Likewise.
+ * gcc.target/aarch64/stack-checking.c: Likewise.
+ * gcc.target/arm/stack-checking.c: Likewise.
+ * gcc.target/i386/pr48723.c: Likewise.
+ * gcc.target/i386/pr55672.c: Likewise.
+ * gcc.target/i386/pr67265-2.c: Likewise.
+ * gcc.target/i386/pr67265.c: Likewise.
+ * gnat.dg/opt49.adb: Likewise.
+ * gnat.dg/stack_check1.adb: Likewise.
+ * gnat.dg/stack_check2.adb: Likewise.
+ * gnat.dg/stack_check3.adb: Likewise.
+
2017-07-05 Kelvin Nilsen <kelvin@gcc.gnu.org>
PR target/80103
// Testcase by Zdenek Sojka <zsojka@seznam.cz>
// { dg-do run { target i?86-*-* x86_64-*-* } }
+/* { dg-require-stack-check "" } */
// { dg-options "-Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer" }
int main()
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-require-stack-check "" } */
/* { dg-additional-options "-fstack-check" } */
#include "20031023-1.c"
+/* { dg-require-stack-check "generic" } */
/* { dg-options "-O -fstack-check=generic -ftree-pre -fgraphite-identity" } */
/* nvptx doesn't expose a stack. */
/* { dg-skip-if "" { nvptx-*-* } } */
/* PR tree-optimization/47443 */
/* { dg-do compile } */
+/* { dg-require-stack-check "generic" } */
/* { dg-options "-O -fstack-check=generic" } */
static inline int bar (char *c, int i)
/* { dg-do compile } */
+/* { dg-require-stack-check "specific" } */
/* { dg-options "-O2 -fstack-check=specific -fno-tree-dse -fno-tree-fre -fno-tree-loop-optimize -g" } */
struct S
/* { dg-do compile } */
+/* { dg-require-stack-check "generic" } */
/* { dg-options "-fstack-check=generic" } */
/* Check that the expected warning is issued for large frames. */
/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-require-stack-check "" } */
/* { dg-options "-fstack-check" } */
int main(void)
/* { dg-do run { target { *-*-linux* } } } */
+/* { dg-require-stack-check "" } */
/* { dg-options "-fstack-check" } */
-/* { dg-skip-if "" { arm_thumb1 } } */
int main(void)
{
/* { dg-do compile } */
+/* { dg-require-stack-check "" } */
/* { dg-options "-fstack-check -mavx" } */
struct S0
/* { dg-do compile } */
+/* { dg-require-stack-check "generic" } */
/* { dg-options "-O -fstack-check=generic" } */
int main ()
/* { dg-do compile } */
+/* { dg-require-stack-check "" } */
/* { dg-options "-O -fstack-check" } */
void foo (int n)
/* Reduced testcase by Johannes Dewender <gnu@JonnyJD.net> */
/* { dg-do compile } */
+/* { dg-require-stack-check "" } */
/* { dg-options "-O -fstack-check -fPIC" } */
int a, b, c, d, e;
-- { dg-do run }
+-- { dg-require-stack-check "" }
-- { dg-options "-O -fstack-check" }
procedure Opt49 is
-- { dg-do run }
+-- { dg-require-stack-check "" }
-- { dg-options "-fstack-check" }
-- This test requires architecture- and OS-specific support code for unwinding
-- { dg-do run }
+-- { dg-require-stack-check "" }
-- { dg-options "-fstack-check" }
-- This test requires architecture- and OS-specific support code for unwinding
-- { dg-do compile }
+-- { dg-require-stack-check "" }
-- { dg-options "-O -fstack-check" }
package body Stack_Check3 is
}
}
+# If this target does not support the "stack-check" option, skip this
+# test.
+
+proc dg-require-stack-check { args } {
+ set stack_check_available [ check_stack_check_available [lindex $args 1 ] ]
+ if { $stack_check_available == -1 } {
+ upvar name name
+ unresolved "$name"
+ }
+ if { $stack_check_available != 1 } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
# Add any target-specific flags needed for accessing the given list
# of features. This must come after all dg-options.
} "-fstack-protector"]
}
+# Return 1 if the target supports -fstack-check or -fstack-check=$stack_kind
+proc check_stack_check_available { stack_kind } {
+ if [string match "" $stack_kind] then {
+ set stack_opt "-fstack-check"
+ } else { set stack_opt "-fstack-check=$stack_kind" }
+
+ return [check_no_compiler_messages stack_check executable {
+ int main (void) { return 0; }
+ } "$stack_opt"]
+}
+
# Return 1 if compilation with -freorder-blocks-and-partition is error-free
# for trivial code, 0 otherwise. As some targets (ARM for example) only
# warn when -fprofile-use is also supplied we test that combination too.