On Wed, 9 Jun 2021, Eric Botcazou wrote: > > I'm afraid the inliner would need to prove the to be inlined callee doesn't > > modify its own copy of the variable too, because if it modifies it (at least > > in C/C++ const can be cast away), then this introduces wrong-code, see > > PR100994 for details. > > Then please remove the TREE_READONLY marker in C/C++ if this is a lie.
I agree the cases are invalid C/C++ - this isn't casting away const qualification of a pointed to type but of an object and storing into a readonly object at least invokes undefined behavior. It might even be allowed to diagnose it as error. Richard.