Hi! On Fri, Nov 04, 2016 at 10:17:31AM +0100, Martin Liška wrote: > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index 813777d..86ce793 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > @@ -1678,7 +1678,9 @@ warn_switch_unreachable_r (gimple_stmt_iterator *gsi_p, > bool *handled_ops_p, > worse location info. */ > if (gimple_try_eval (stmt) == NULL) > { > - wi->info = stmt; > + gimple_stmt_iterator *it = XNEW (gimple_stmt_iterator); > + memcpy (it, gsi_p, sizeof (gimple_stmt_iterator));
That would be cleaner as *it = *gsi_p; That set, I fail to see 1) the need to use a gsi pointer in wi->info compared to stmt itself, you can gsi_for_stmt cheaply at any time 2) why is anything done about this in warn_switch_unreachable_r - the problem isn't related to this warning IMHO. Even switch (x) { case 1: int x; x = 6; ptr = &x; break; case 2: ptr = &x; *ptr = 7; break; } has the same issue and there is no switch unreachable code there, but you still want for -fsanitize-use-after-scope pretend it is actually: x_tmp = x; { int x; switch (x_tmp) { case 1: x = 6; ptr = &x; break; case 2: ptr = &x; *ptr = 7; break; } } and put ASAN_MARK unpoisoning before GIMPLE_SWITCH. Jakub