re PR sanitizer/84307 (asan blocks dead-store elimination)

gcc:
2018-02-12  Paolo Bonzini <bonzini@gnu.org>

	PR sanitizer/84307
	* internal-fn.def (ASAN_CHECK): Fix fnspec to account for return value.
	(ASAN_MARK): Fix fnspec to account for return value, change pointer
	argument from 'R' to 'W' so that the pointed-to datum is clobbered.

gcc/testsuite:
2018-02-12  Paolo Bonzini  <bonzini@gnu.org>

	PR sanitizer/84307
	* gcc.dg/asan/pr84307.c: New test.

From-SVN: r257585
This commit is contained in:
Paolo Bonzini 2018-02-12 12:47:56 +00:00 committed by Paolo Bonzini
parent 4ec4afa8c1
commit 74a5138a61
4 changed files with 35 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2018-02-12 Paolo Bonzini <bonzini@gnu.org>
PR sanitizer/84307
* internal-fn.def (ASAN_CHECK): Fix fnspec to account for return value.
(ASAN_MARK): Fix fnspec to account for return value, change pointer
argument from 'R' to 'W' so that the pointed-to datum is clobbered.
2018-02-08 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/83665

View File

@ -255,8 +255,8 @@ DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.")
DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, ".R...")
DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, ".R..")
DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, "..R..")
DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, "..W.")
DEF_INTERNAL_FN (ASAN_POISON, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
DEF_INTERNAL_FN (ADD_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)

View File

@ -1,3 +1,8 @@
2018-02-12 Paolo Bonzini <bonzini@gnu.org>
PR sanitizer/84307
* gcc.dg/asan/pr84307.c: New test.
2018-02-12 Nathan Sidwell <nathan@acm.org>
* g++.dg/parse/pr84263.C: New.

View File

@ -0,0 +1,21 @@
/* PR middle-end/83185 */
/* { dg-do link } */
/* { dg-options "-O1" } */
struct f {
void (*func)(void);
};
extern void link_error(void);
extern int printf(const char *f, ...);
static inline struct f *gimme_null(struct f *result)
{
return 0;
}
int main(int argc, char **argv)
{
struct f *x = gimme_null(&(struct f) { .func = link_error });
printf("%p", x);
}