Hello,
You are absolutely right, we can't throw all side-effects away.
Example:
```c++
auto __attribute__ ((noinline)) bar()
{
volatile int* b = (int *)0xff;
*b = 10;
volatile auto n = nullptr;
return n; // Problem (1)
}
int* foo_2()
{
volatile auto
On 1/11/24 15:34, Dmitry Drozodv wrote:
You are absolutely right, we can't throw all side-effects away.
+ /* C++ [conv.lval]p3:
+If T is cv std::nullptr_t, the result is a null pointer constant. */
+ return ((TREE_SIDE_EFFECTS (expr) && !CONVERT_EXPR_P (expr))
+ ?
[PATCH v3] c++: side effect in nullptr_t conversion fix
Hi,
> This seems to assume that a CONVERT_EXPR can't have any other
> side-effects nested in it.
>
> It seems to me a better approach is the one in keep_unused_object_arg
> and cp_gimplify_expr, basically
>
> if (TREE_THIS_VOLATILE (e))
>