On Wed, 23 May 2018, Rogerio Alves wrote:
I don't think that alloca/memset should destroy the caller stack like is
happening but, also I think we have to restore TOC to the caller frame after
the longjmp in that case also. I don't know if there's any other more direct
and robust ways to checking if TOC is correctly restored. I can't think in
anything easier than always restore.
I'm not challenging the idea that "always restoring" is an appropriate fix.
My question was about *verifying* that TOC register is restored as it ought
to, i.e. how the testcase needs to work. Right now, the test uses my code
from Bugzilla that worked okay for demonstration purposes, but has issues as
a long-term testsuite addition:
* it demonstrates the issue in a very intransparent fashion, relying on
non-obvious interaction with alloca-memset part of the test;
* when GCC manages to optimize out the alloca-memset part, the test
will cease to work for the intended purpose.
Alexander