diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-11-24 11:29:54 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-11-24 11:29:54 +0100 |
commit | b6330a7685476fc30b8ae9bbf3fca1a9b0d4be95 (patch) | |
tree | 138f2e04002ea9258936ceb760f83e8eb149f3c4 /gcc/asan.cc | |
parent | 7f77aa6b2f04781faa78373add11538d276c8ae4 (diff) | |
download | gcc-b6330a7685476fc30b8ae9bbf3fca1a9b0d4be95.zip gcc-b6330a7685476fc30b8ae9bbf3fca1a9b0d4be95.tar.gz gcc-b6330a7685476fc30b8ae9bbf3fca1a9b0d4be95.tar.bz2 |
asan: Fix up error recovery for too large frames [PR107317]
asan_emit_stack_protection and functions it calls have various asserts that
verify sanity of the stack protection instrumentation. But, that
verification can easily fail if we've diagnosed a frame offset overflow.
asan_emit_stack_protection just emits some extra code in the prologue,
if we've reported errors, we aren't producing assembly, so it doesn't
really matter if we don't include the protection code, compilation
is going to fail anyway.
2022-11-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/107317
* asan.cc: Include diagnostic-core.h.
(asan_emit_stack_protection): Return NULL early if seen_error ().
* gcc.dg/asan/pr107317.c: New test.
Diffstat (limited to 'gcc/asan.cc')
-rw-r--r-- | gcc/asan.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/asan.cc b/gcc/asan.cc index 8276f12..dc7b7f4 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 (); |