aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-15.c17
-rw-r--r--gcc/testsuite/gnat.dg/stack_usage4.adb11
-rw-r--r--gcc/testsuite/gnat.dg/stack_usage4_pkg.ads12
4 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3b2f638..138899a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/Walloca-15.c: New test.
+ * gnat.dg/stack_usage4.adb: Likewise.
+ * gnat.dg/stack_usage4_pkg.ads: New helper.
+
2017-10-19 Jakub Jelinek <jakub@redhat.com>
PR c++/82600
diff --git a/gcc/testsuite/gcc.dg/Walloca-15.c b/gcc/testsuite/gcc.dg/Walloca-15.c
new file mode 100644
index 0000000..f34ffd9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloca-15.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target alloca } */
+/* { dg-options "-Walloca-larger-than=128 -O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void bar (void*);
+
+void foo1 (size_t len)
+{
+ bar (__builtin_alloca_with_align_and_max (len, 8, 128));
+}
+
+void foo2 (size_t len)
+{
+ bar (__builtin_alloca_with_align_and_max (len, 8, 256)); /* { dg-warning "may be too large" } */
+}
diff --git a/gcc/testsuite/gnat.dg/stack_usage4.adb b/gcc/testsuite/gnat.dg/stack_usage4.adb
new file mode 100644
index 0000000..24cd1a7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/stack_usage4.adb
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+-- { dg-options "-Wstack-usage=512" }
+
+with Stack_Usage4_Pkg; use Stack_Usage4_Pkg;
+
+procedure Stack_Usage4 is
+ BS : Bounded_String := Get;
+ S : String := BS.Data (BS.Data'First .. BS.Len);
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/stack_usage4_pkg.ads b/gcc/testsuite/gnat.dg/stack_usage4_pkg.ads
new file mode 100644
index 0000000..9bad627
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/stack_usage4_pkg.ads
@@ -0,0 +1,12 @@
+package Stack_Usage4_Pkg is
+
+ subtype Name_Index_Type is Natural range 1 .. 63;
+
+ type Bounded_String is record
+ Len : Name_Index_Type;
+ Data : String (Name_Index_Type'Range);
+ end record;
+
+ function Get return Bounded_String;
+
+end Stack_Usage4_Pkg;