aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-07-12 16:50:41 +0000
committerJakub Jelinek <jakub@redhat.com>2018-07-12 16:50:41 +0000
commit1ed159550621e4b1cf35ab868e0a7d51e2837724 (patch)
tree9bad8e165e1df1b26197b4700f9f51566152a405 /gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
parentc1e7aa1d88a3110f71b740fc8ea11f3274cae433 (diff)
parentf7d3a6a6300a4c330afca4d8772ac80ab09ac21c (diff)
svn merge -r258208:262569 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branchredhat/gcc-7-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-7-branch@262599 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c')
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
new file mode 100644
index 00000000000..41e523c6958
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1PB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1000 * 1000 * 1000 * 1000 * 1000; /* 1 petabyte (PB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000000000000001. exceeds maximum object size 1000000000000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}