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

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

https://gcc.gnu.org/g:37bde2f87267908a93c07856317a28827f8284f7

commit r11-7294-g37bde2f87267908a93c07856317a28827f8284f7
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Feb 19 12:14:39 2021 +0100

    tree-cfg: Fix up gimple_merge_blocks FORCED_LABEL handling [PR99034]

    The verifiers require that DECL_NONLOCAL or EH_LANDING_PAD_NR
    labels are always the first label if there is more than one label.

    When merging blocks, we don't honor that though.
    On the following testcase, we try to merge blocks:
    <bb 13> [count: 0]:
    <L2>:
    S::~S (&s);

    and
    <bb 15> [count: 0]:
    <L0>:
    resx 1

    where <L2> is landing pad and <L0> is FORCED_LABEL.  And the code puts
    the FORCED_LABEL before the landing pad label, violating the verification
    requirements.

    The following patch fixes it by moving the FORCED_LABEL after the
    DECL_NONLOCAL or EH_LANDING_PAD_NR label if it is the first label.

    2021-02-19  Jakub Jelinek  <ja...@redhat.com>

            PR ipa/99034
            * tree-cfg.c (gimple_merge_blocks): If bb a starts with eh landing
            pad or non-local label, put FORCED_LABELs from bb b after that
label
            rather than before it.

            * g++.dg/opt/pr99034.C: New test.

Reply via email to