2017-06-10 Tom de Vries <tom@codesourcery.com>
* lib/target-supports.exp (check_effective_target_stack_size)
(dg-effective-target-value): New proc.
* lib/gcc.exp (gcc_target_compile): Remove adding of DSTACK_SIZE to
additional_flags.
* lib/objc.exp (objc_target_compile): Same.
* lib/profopt.exp (profopt-get-options): Allow dg-additional-options.
* g++.old-deja/g++.eh/badalloc1.C: Add -DSTACK_SIZE=<value> using
dg-additional-options.
* gcc.c-torture/compile/
20080806-1.c: Same.
* gcc.c-torture/compile/920723-1.c: Same.
* gcc.c-torture/compile/930621-1.c: Same.
* gcc.c-torture/compile/991214-2.c: Same.
* gcc.c-torture/compile/bcopy.c: Same.
* gcc.c-torture/compile/memtst.c: Same.
* gcc.c-torture/compile/msp.c: Same.
* gcc.c-torture/compile/stuct.c: Same.
* gcc.c-torture/execute/
20011008-3.c: Same.
* gcc.c-torture/execute/
20030209-1.c: Same.
* gcc.c-torture/execute/
20031012-1.c: Same.
* gcc.c-torture/execute/
20040805-1.c: Same.
* gcc.c-torture/execute/920410-1.c: Same.
* gcc.c-torture/execute/920501-7.c: Same.
* gcc.c-torture/execute/921113-1.c: Same.
* gcc.c-torture/execute/921202-1.c: Same.
* gcc.c-torture/execute/921208-2.c: Same.
* gcc.c-torture/execute/930106-1.c: Same.
* gcc.c-torture/execute/930406-1.c: Same.
* gcc.c-torture/execute/950221-1.c: Same.
* gcc.c-torture/execute/960521-1.c: Same.
* gcc.c-torture/execute/980605-1.c: Same.
* gcc.c-torture/execute/comp-goto-1.c: Same.
* gcc.c-torture/execute/comp-goto-2.c: Same.
* gcc.c-torture/execute/memcpy-1.c: Same.
* gcc.c-torture/execute/multi-ix.c: Same.
* gcc.c-torture/execute/nestfunc-4.c: Same.
* gcc.c-torture/execute/pr20621-1.c: Same.
* gcc.c-torture/execute/pr23135.c: Same.
* gcc.c-torture/execute/pr28982b.c: Same.
* gcc.dg/loop-3.c: Same.
* gcc.dg/struct-ret-3.c: Same.
* gcc.dg/torture/stackalign/comp-goto-1.c: Same.
* gcc.dg/torture/stackalign/non-local-goto-4.c: Same.
* gcc.dg/tree-prof/comp-goto-1.c: Same.
* gcc.dg/tree-prof/pr44777.c: Same.
* doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
Document effective target stack_size.
From-SVN: r249090
+2017-06-10 Tom de Vries <tom@codesourcery.com>
+
+ * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
+ Document effective target stack_size.
+
2017-06-09 David Malcolm <dmalcolm@redhat.com>
* diagnostic.c (diagnostic_report_diagnostic): Only add fixits
@item short_enums
Target defaults to short enums.
+@item stack_size
+Target has limited stack size. The stack size limit can be obtained using
+@code{[dg-effective-target-value stack_size]}. For example:
+@smallexample
+/* @{ dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" @{ target @{ stack_size @} @} @} */
+@end smallexample
+
@item static
Target supports @option{-static}.
+2017-06-10 Tom de Vries <tom@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_stack_size)
+ (dg-effective-target-value): New proc.
+ * lib/gcc.exp (gcc_target_compile): Remove adding of DSTACK_SIZE to
+ additional_flags.
+ * lib/objc.exp (objc_target_compile): Same.
+ * lib/profopt.exp (profopt-get-options): Allow dg-additional-options.
+ * g++.old-deja/g++.eh/badalloc1.C: Add -DSTACK_SIZE=<value> using
+ dg-additional-options.
+ * gcc.c-torture/compile/20080806-1.c: Same.
+ * gcc.c-torture/compile/920723-1.c: Same.
+ * gcc.c-torture/compile/930621-1.c: Same.
+ * gcc.c-torture/compile/991214-2.c: Same.
+ * gcc.c-torture/compile/bcopy.c: Same.
+ * gcc.c-torture/compile/memtst.c: Same.
+ * gcc.c-torture/compile/msp.c: Same.
+ * gcc.c-torture/compile/stuct.c: Same.
+ * gcc.c-torture/execute/20011008-3.c: Same.
+ * gcc.c-torture/execute/20030209-1.c: Same.
+ * gcc.c-torture/execute/20031012-1.c: Same.
+ * gcc.c-torture/execute/20040805-1.c: Same.
+ * gcc.c-torture/execute/920410-1.c: Same.
+ * gcc.c-torture/execute/920501-7.c: Same.
+ * gcc.c-torture/execute/921113-1.c: Same.
+ * gcc.c-torture/execute/921202-1.c: Same.
+ * gcc.c-torture/execute/921208-2.c: Same.
+ * gcc.c-torture/execute/930106-1.c: Same.
+ * gcc.c-torture/execute/930406-1.c: Same.
+ * gcc.c-torture/execute/950221-1.c: Same.
+ * gcc.c-torture/execute/960521-1.c: Same.
+ * gcc.c-torture/execute/980605-1.c: Same.
+ * gcc.c-torture/execute/comp-goto-1.c: Same.
+ * gcc.c-torture/execute/comp-goto-2.c: Same.
+ * gcc.c-torture/execute/memcpy-1.c: Same.
+ * gcc.c-torture/execute/multi-ix.c: Same.
+ * gcc.c-torture/execute/nestfunc-4.c: Same.
+ * gcc.c-torture/execute/pr20621-1.c: Same.
+ * gcc.c-torture/execute/pr23135.c: Same.
+ * gcc.c-torture/execute/pr28982b.c: Same.
+ * gcc.dg/loop-3.c: Same.
+ * gcc.dg/struct-ret-3.c: Same.
+ * gcc.dg/torture/stackalign/comp-goto-1.c: Same.
+ * gcc.dg/torture/stackalign/non-local-goto-4.c: Same.
+ * gcc.dg/tree-prof/comp-goto-1.c: Same.
+ * gcc.dg/tree-prof/pr44777.c: Same.
+
2017-06-09 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
// itself call malloc(), and will fail if there is no more
// memory available.
// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } }
+// { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } }
// Copyright (C) 2000, 2002, 2003, 2010, 2012, 2014 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* This used to ICE on s390x due to a reload bug. */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#if defined(STACK_SIZE) && STACK_SIZE < 65536
# define GITT_SIZE 75
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L
#endif
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define HISTO_SIZE 9
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
void
bcopy1 (s, d, c)
long long *s;
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
# define A_SIZE (STACK_SIZE/sizeof(int))
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
extern void exit (int);
extern void abort (void);
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#if STACK_SIZE < 8*100*100
#define SKIP
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* PR optimization/8750
Used to fail under Cygwin with
-O2 -fomit-frame-pointer
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000)
int main () { exit (0); }
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (40000 * 4 + 256)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1)
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (128 * 128 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifndef STACK_SIZE
#define VLEN 2055
#else
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (100000 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined (STACK_SIZE)
#define DUMMY_SIZE 9
#else
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
f()
{
int x = 1;
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
struct parsefile
{
long fd;
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdlib.h>
int *a, *b;
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdio.h>
#ifndef STACK_SIZE
/* { dg-require-effective-target label_values } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#include <stdlib.h>
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
/* A slight variation of 920501-7.c. */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <string.h>
#if defined (STACK_SIZE)
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Test for a reload bug:
if you have a memory reference using the indexed addressing
mode, and the base address is a pseudo containing an address in the frame
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Origin: hp@bitrange.com
Test that return values come out right from a 1000-level call chain to
functions without parameters that each need at least one "long"
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* When generating o32 MIPS PIC, main's $gp save slot was out of range
of a single load instruction. */
struct big { int i[sizeof (int) >= 4 && sizeof (void *) >= 4 ? 0x4000 : 4]; };
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Based on execute/simd-1.c, modified by joern.rennecke@st.com to
trigger a reload bug. Verified for gcc mainline from 20050722 13:00 UTC
for sh-elf -m4 -O2. */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Like pr28982a.c, but with the spill slots outside the range of
a single sp-based load on ARM. This test tests for cases where
the addresses in the base and index reloads require further reloads. */
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-options "-O3 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L
/* Origin: Peeter Joot <peeterj@ca.ibm.com> */
/* { dg-do run { target *-*-linux* *-*-gnu* } } */
-
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>
/* { dg-do run } */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1)
/* { dg-require-effective-target nonlocal_goto } */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
extern void abort (void);
extern void exit (int);
/* { dg-require-effective-target freorder } */
/* { dg-require-effective-target label_values } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdlib.h>
#if (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
/* { dg-options "-O0" } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* A variant of gcc.c-torture/execute/comp-goto-2.c. */
extern void abort (void);
lappend options "ldflags=$TEST_EXTRA_LIBS"
}
- if [target_info exists gcc,stack_size] {
- lappend options "additional_flags=-DSTACK_SIZE=[target_info gcc,stack_size]"
- }
if [target_info exists gcc,signal_suppress] {
lappend options "additional_flags=-DSIGNAL_SUPPRESS"
}
lappend options "ldflags=$wrap_flags"
}
- if [target_info exists objc,stack_size] {
- lappend options "additional_flags=-DSTACK_SIZE=[target_info objc,stack_size]"
- }
-
# TEST_ALWAYS_FLAGS are flags that should be passed to every
# compilation. They are passed first to allow individual
# tests to override them.
foreach op $tmp {
set cmd [lindex $op 0]
if { ![string compare "dg-options" $cmd] \
+ || ![string compare "dg-additional-options" $cmd] \
|| ![string compare "dg-skip-if" $cmd] \
|| ![string compare "dg-final-generate" $cmd] \
|| ![string compare "dg-final-use" $cmd] \
return 1
}
+# Return 1 if target has limited stack size.
+
+proc check_effective_target_stack_size { } {
+ if [target_info exists gcc,stack_size] {
+ return 1
+ }
+ return 0
+}
+
+# Return the value attribute of an effective target, otherwise return 0.
+
+proc dg-effective-target-value { effective_target } {
+ if { "$effective_target" == "stack_size" } {
+ if [check_effective_target_stack_size] {
+ return [target_info gcc,stack_size]
+ }
+ }
+
+ return 0
+}
+
# Return 1 if according to target_info struct and explicit target list
# target disables -fdelete-null-pointer-checks. Targets should return 0
# if they simply default to -fno-delete-null-pointer-checks but obey