On Wed, Sep 23, 2015 at 08:55:53PM +0200, Bernd Schmidt wrote: > On 09/23/2015 06:07 PM, Marek Polacek wrote: > >Given that the code above seems to be useless now, I think let's put this > >patch in as-is, backport it to gcc-5, then remove those redundant hunks on > >trunk and add the testcase above. Do you agree? > > Sounds reasonable. If you can find a point in the history where that code > wasn't useless, it would be good to help us understand why it's there.
I did some archeology. The code wasn't useless since it was added (r211859) till r226110 where I added some unshare_exprs. On the testcase I posted earlier in the thread that makes a difference: @@ -11,7 +11,7 @@ else { <<< Unknown tree: void_cst >>> - }, (long unsigned int) (s->a[i] << SAVE_EXPR <i>);; + }, (long unsigned int) (s->a[UBSAN_BOUNDS (0B, SAVE_EXPR <i>, 0);, SAVE_EXPR <i>;] << SAVE_EXPR <i>);; } So we instrument the array multiple times as it's not shared anymore. Ok to proceed with the plan I mentioned above? Marek