From: Maxim Ostapenko Date: Mon, 19 Mar 2018 19:59:56 +0000 (+0000) Subject: re PR sanitizer/78651 (Incorrect exception handling when catch clause uses local... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=058494f991ff11adee3458c6ac62fcbed28761df;p=gcc.git re PR sanitizer/78651 (Incorrect exception handling when catch clause uses local class and PIC and sanitizer are active) 2018-03-19 Maxim Ostapenko gcc/ PR sanitizer/78651 * dwarf2asm.c (dw2_output_indirect_constant_1): Disable ASan before calling assemble_variable. gcc/testsuite/ PR sanitizer/78651 * g++.dg/asan/pr78651.C: New test. From-SVN: r258658 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 713e9642833..7745ef61548 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-19 Maxim Ostapenko + + PR sanitizer/78651 + * dwarf2asm.c (dw2_output_indirect_constant_1): Disable ASan before + calling assemble_variable. + 2018-03-19 Sudakshina Das PR target/81647 diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index e9b18b8b785..2e108acc0d7 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -967,7 +967,13 @@ dw2_output_indirect_constant_1 (const char *sym, tree id) } sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym); + /* Disable ASan for decl because redzones cause ABI breakage between GCC and + libstdc++ for `.LDFCM*' variables. See PR 78651 for details. */ + unsigned int save_flag_sanitize = flag_sanitize; + flag_sanitize &= ~(SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS + | SANITIZE_KERNEL_ADDRESS); assemble_variable (decl, 1, 1, 1); + flag_sanitize = save_flag_sanitize; assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1); return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a15d69cccd..e3309b33d1b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-19 Maxim Ostapenko + + PR sanitizer/78651 + * g++.dg/asan/pr78651.C: New test. + 2018-03-19 Tom de Vries * gcc.dg/tree-ssa/pr84512.c: Don't require effective target diff --git a/gcc/testsuite/g++.dg/asan/pr78651.C b/gcc/testsuite/g++.dg/asan/pr78651.C new file mode 100644 index 00000000000..09f1be538c3 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr78651.C @@ -0,0 +1,26 @@ +// PR sanitizer/78651 +// { dg-do run } +// { dg-additional-options "-fpic" { target fpic } } + +struct A { }; + +namespace { + +void thisThrows () { + throw A(); +} + +struct SomeRandomType {}; +} + +int main() { + try { + thisThrows(); + } + catch (SomeRandomType) { + throw; + } + catch (A) { + } + return 0; +}