Re: [PATCH] c++: Unshare folded SAVE_EXPR arguments during cp_fold [PR112727]

2023-12-08 Thread Jason Merrill
On 12/8/23 12:35, Jakub Jelinek wrote: On Fri, Dec 08, 2023 at 11:51:19AM -0500, Jason Merrill wrote: Do we want to do the same for TARGET_EXPR, since those are handled like SAVE_EXPR in mostly_copy_tree_r? In mostly_copy_tree_r yes, but I don't see cp_fold doing anything for TARGET_EXPRs (lik

Re: [PATCH] c++: Unshare folded SAVE_EXPR arguments during cp_fold [PR112727]

2023-12-08 Thread Jakub Jelinek
On Fri, Dec 08, 2023 at 11:51:19AM -0500, Jason Merrill wrote: > Do we want to do the same for TARGET_EXPR, since those are handled like > SAVE_EXPR in mostly_copy_tree_r? In mostly_copy_tree_r yes, but I don't see cp_fold doing anything for TARGET_EXPRs (like it does for SAVE_EXPRs), so I think T

Re: [PATCH] c++: Unshare folded SAVE_EXPR arguments during cp_fold [PR112727]

2023-12-08 Thread Jason Merrill
On 12/7/23 04:28, Jakub Jelinek wrote: Hi! The following testcase is miscompiled because two ubsan instrumentations run into each other. The first one is the shift instrumentation. Before the C++ FE calls it, it wraps the 2 shift arguments with cp_save_expr, so that side-effects in them aren't

[PATCH] c++: Unshare folded SAVE_EXPR arguments during cp_fold [PR112727]

2023-12-07 Thread Jakub Jelinek
Hi! The following testcase is miscompiled because two ubsan instrumentations run into each other. The first one is the shift instrumentation. Before the C++ FE calls it, it wraps the 2 shift arguments with cp_save_expr, so that side-effects in them aren't evaluated multiple times. And, ubsan_ins