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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:6436add49ed9ecf74f1f01b4fe18961df4f3e83d

commit r13-5965-g6436add49ed9ecf74f1f01b4fe18961df4f3e83d
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Feb 13 10:41:51 2023 +0100

    tree-optimization/108691 - indirect calls to setjmp

    DCE now chokes on indirect setjmp calls becoming direct because
    that exposes them too late to be subject to abnormal edge creation.
    The following patch honors gimple_call_ctrl_altering for those and
    _not_ treat formerly indirect calls to setjmp as calls to setjmp
    in notice_special_calls.

    Unfortunately there's no way to have an indirect call to setjmp
    properly annotated (the returns_twice attribute is ignored on types).

    RTL expansion late discovers returns-twice for the purpose of
    adding REG_SETJMP notes and also sets ->calls_setjmp
    (instead of asserting it is set).  There's no good way to
    transfer proper knowledge around here so I'm using ->calls_setjmp
    as a flag to indicate whether gimple_call_ctrl_altering_p was set.

            PR tree-optimization/108691
            * tree-cfg.cc (notice_special_calls): When the CFG is built
            honor gimple_call_ctrl_altering_p.
            * cfgexpand.cc (expand_call_stmt): Clear cfun->calls_setjmp
            temporarily if the call is not control-altering.
            * calls.cc (emit_call_1): Do not add REG_SETJMP if
            cfun->calls_setjmp is not set.  Do not alter cfun->calls_setjmp.

            * gcc.dg/pr108691.c: New testcase.

Reply via email to