On Thu, Aug 17, 2017 at 07:02:14PM -0500, Peter Bergner wrote: > PR target/80210 exposes a problem in rs6000_set_current_function() where > is fails to correctly clear the rs6000_previous_fndecl cache correctly. > With the test case, we notice that rs6000_previous_fndecl is set (when it > shouldn't be) and we end up restoring options from it. In this case, > we end up disabling HW sqrt (because of the pragma) when we earlier > decided we could generate HW sqrts which leads to an ICE. > > The current code in rs6000_set_current_function() is kind of a rats nest, > so I threw it out and rewrote it, modeling it after how S390 and i386 > handle it, which correctly clears the *_previous_fndecl caches. > It also makes the code much more readable in my view.
Yeah, it almost looks easy this way. Treacherous :-) > This passed bootstrap and regtesting with no regressions and it fixes > the ICE. Ok for trunk? > > This is also broken in GCC 7, GCC 6 and GCC 5. Ok for those after this > has been on trunk for a little while and assuming testing passes? Okay for trunk and all branches. Thanks! Segher > gcc/ > * config/rs6000/rs6000.c (rs6000_activate_target_options): New function. > (rs6000_set_current_function): Rewrite function to use it. > > gcc/testsuite/ > > * gcc.target/powerpc/pr80210.c: New test.