[Bug middle-end/105071] [9 Regression] Incorrect code with -Os and complex<double>

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 30 11:51:43 GMT 2022


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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:1dc4bed43760c4e291e072aa0c8c450f5775e25f

commit r9-10000-g1dc4bed43760c4e291e072aa0c8c450f5775e25f
Author: Martin Jambor <mjambor@suse.cz>
Date:   Wed Mar 30 13:47:24 2022 +0200

    cplxlower: Avoid a transform when looking at a default definition

    In PR 97456, IPA-SRA triggers a bug in tree-complex.c where it
    converts:

     <bb 2>
       a$_M_value_21 = COMPLEX_EXPR <ISRA.18_10(D), ISRA.18_10(D)>;

    (where ISRA.18 is IPA-SRA created PARM_DECL with DECL_IGNORED_P set,
    which is why it only happens with IPA-SRA) into:

      <bb 2>
        a$_M_value_21 = COMPLEX_EXPR <a$_M_value$real_10(D),
a$_M_value$real_10(D)>;

    i.e. it replaces two uses of the parameter default-def with two
    uninitialized default-defs of a new variable - all in hope to produce
    code with better debug info.

    This patch fixes it by avoiding the transform when the SSA_NAME to be
    replaced is a default definition.

    gcc/ChangeLog:

    2020-10-19  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/97456
            PR middle-end/105071
            * tree-complex.c (set_component_ssa_name): Do not replace ignored
decl
            default definitions with new component vars.  Reorder if
conditions.

    gcc/testsuite/ChangeLog:

    2020-10-19  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/97456
            * gcc.dg/tree-ssa/pr97456.c: New test.

    (cherry picked from commit 619f91eaa8c8a50f1f9d3e7b96ee837037f0e806)


More information about the Gcc-bugs mailing list