On 13/02/2018 14:35, Jakub Jelinek wrote: > On Tue, Feb 13, 2018 at 12:21:55PM +0100, Jakub Jelinek wrote: >> On Tue, Feb 13, 2018 at 12:15:36PM +0100, Paolo Bonzini wrote: >>> The issue is that the ASAN_CHECK doesn't exist at early DSE time, and >>> thus causes the store to disappear. >> >> If it was DSE removing the stores before asan pass, then it would FAIL >> before as well. > > Sorry, while ASAN_CHECK is introduced late, ASAN_MARK is present there > already from the gimplification.
Yeah, and it keeps everything alive. > For use after scope, I guess a lot of the stores after end of scope > (rather than reads) are something DSE could consider removing. > So, shall we just disable DSE on vars where their address "escapes" > through ASAN_MARK when -fsanitize-address-use-after-scope? But the stores _are_ dead; it's only the ASAN_CHECK that isn't. Hence the idea of doing the entire instrumentation very early. > Generally, dead stores could be eliminable when stored before the > corresponding ASAN_MARK poison (but even ASAN_MARK with "..W.." will > prevent those) and uneliminable when stored after ASAN_MARK poison. > > For the "fn spec" for now, I'd just go with "..R.." for ASAN_CHECK and > NULL for ASAN_MARK for now. I'm a bit scared of that even, :) especially in stage4. If you think it's safe enough, I can give it a shot, but honestly I wouldn't have much time to deal with the fallout now (hence the quick revert). Paolo