[Bug middle-end/94724] [10 Regression] wrong code at -O0 on x86_64-linux-gnu since r10-7344-gca6c722561ce9b9d

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 8 07:49:01 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94724

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:3a296f322dea92747a0874cb1fd073313749673e

commit r10-8123-g3a296f322dea92747a0874cb1fd073313749673e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri May 8 09:37:09 2020 +0200

    tree: Avoid variable sharing in get_narrower [PR94724]

    On Thu, May 07, 2020 at 02:45:29PM +0200, Thomas Schwinge wrote:
    > >>+      for (tree op = win; TREE_CODE (op) == COMPOUND_EXPR;
    >
    > ..., and new 'op' variable here.
    >
    > >>+        op = TREE_OPERAND (op, 1))
    > >>+     v.safe_push (op);
    > >>+      FOR_EACH_VEC_ELT_REVERSE (v, i, op)
    > >>+     ret = build2_loc (EXPR_LOCATION (op), COMPOUND_EXPR,
    > >>+                       TREE_TYPE (win), TREE_OPERAND (op, 0),
    > >>+                       ret);
    > >>+      return ret;
    > >>     }
    > >>   while (TREE_CODE (op) == NOP_EXPR)
    > >>     {

    There is no reason for the shadowing and op at this point acts as a
    temporary and will be overwritten in FOR_EACH_VEC_ELT_REVERSE anyway.
    So, we can just s/tree // here.

    2020-05-08  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/94724
            * tree.c (get_narrower): Reuse the op temporary instead of
            shadowing it.


More information about the Gcc-bugs mailing list