https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86835
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Wed Sep 5 07:21:15 2018 New Revision: 264106 URL: https://gcc.gnu.org/viewcvs?rev=264106&root=gcc&view=rev Log: Backported from mainline 2018-08-11 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/86835 * tree-ssa-math-opts.c (insert_reciprocals): Even when inserting new_stmt after def_gsi, make sure to insert new_square_stmt after that stmt, not 2 stmts before it. * gcc.dg/pr86835.c: New test. Added: branches/gcc-8-branch/gcc/testsuite/gcc.dg/pr86835.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/testsuite/ChangeLog branches/gcc-8-branch/gcc/tree-ssa-math-opts.c