diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2018-06-22 14:59:21 +0000 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2018-06-22 14:59:21 +0000 |
commit | 80bb895d235d82f30bb097050acc82470b53cf52 (patch) | |
tree | d887d893f39d16e4990a853d3398dfc48433430f /gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c | |
parent | 701c5838e5f5999de48c3b2c9f2e10b453a78f88 (diff) | |
parent | 8483773478af7ea732b52a98e325a07608777ebe (diff) |
Merge from gcc-7-branch.ARM/embedded-7-branch-2018q2ARM/embedded-7-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch@261903 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c new file mode 100644 index 00000000000..1eb83a5f613 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c @@ -0,0 +1,25 @@ +/* PR middle-end/82063 - issues with arguments enabled by -Wall + { dg-do compile } + { dg-options "-O -Walloc-size-larger-than=1GiB -ftrack-macro-expansion=0" } */ + +void sink (void*); + +#define T(x) sink (x) + +void f (void) +{ + __SIZE_TYPE__ n = 0; + T (__builtin_malloc (n)); + + n = 1024 * 1024 * 1024; /* 1 gigibyte (GiB) */ + T (__builtin_malloc (n)); + + n += 1; + T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1073741825. exceeds maximum object size 1073741824" } */ + + 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" } */ +} |