diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/asan.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/asan/pr107317.c | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/asan.cc b/gcc/asan.cc index bacf890..f0dca99 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "tree-ssa.h" #include "tree-eh.h" +#include "diagnostic-core.h" /* AddressSanitizer finds out-of-bounds and use-after-free bugs with <2x slowdown on average. @@ -1818,6 +1819,11 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb, tree str_cst, decl, id; int use_after_return_class = -1; + /* Don't emit anything when doing error recovery, the assertions + might fail e.g. if a function had a frame offset overflow. */ + if (seen_error ()) + return NULL; + if (shadow_ptr_types[0] == NULL_TREE) asan_init_shadow_ptr_types (); diff --git a/gcc/testsuite/gcc.dg/asan/pr107317.c b/gcc/testsuite/gcc.dg/asan/pr107317.c new file mode 100644 index 0000000..dd7ad7d --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr107317.c @@ -0,0 +1,13 @@ +/* PR middle-end/107317 */ +/* { dg-do compile { target ilp32 } } */ +/* { dg-options "-fsanitize=address -ffat-lto-objects" } */ + +void bar (float *, float *); + +void +foo (void) /* { dg-error "exceeds maximum" } */ +{ + float a[400000000]; + float b[200000000]; + bar (a, b); +} |