public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/103451] [12 Regression] crash at gcc/range-op.cc:1836 since r12-5531-g1b0acc4b800b589a
Date: Mon, 29 Nov 2021 08:49:40 +0000	[thread overview]
Message-ID: <bug-103451-4-8Nw526skSF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103451-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> So range-op.cc eventually wants to look at 'cfun' which of course is a
> non-go in IPA context.
> 
> void
> operator_div::wi_fold (irange &r, tree type,
>                        const wide_int &lh_lb, const wide_int &lh_ub,
>                        const wide_int &rh_lb, const wide_int &rh_ub) const
> {
> ...
>   // If flag_non_call_exceptions, we must not eliminate a division by zero.
>   if (cfun->can_throw_non_call_exceptions)
>     {
>       r.set_varying (type);
>       return;
> 
> I'm not sure wi_fold should care about "eliminating a division", but surely
> even for non-call EH the actual range of the result doesn't need to care.
> 
> So if sth goes wrong when eliding the above it needs to be fixed upthread
> instead?
> 
> Otherwise a "quick" workaround for the ICE is to check !cfun || ... and
> be conservative.  I see there's no state associated with
> range_fold_binary_expr
> where the IPA context could pass down relevant can_throw_non_call_exceptions.

I honestly can't remember what the rationale was for checking
can_throw_non_call_exceptions.  Perhaps this got added to catch some testcase? 
My gut feeling is that we should be fixing whatever issue upstream, but !cfun
|| ... seems quite harmless.

> 
> I also see
> 
> bool
> fold_using_range::range_of_builtin_call (irange &r, gcall *call,
>                                          fur_source &src)
> ...
>       if (cfun->after_inlining)
>         {
>           r.set_zero (type);
> 
> which might have similar problems (!cfun || ... looks quite reasonable there)

This one came from the old vr-values.c code, so you may have better insight
here ;-)

commit 46dfa8ad6c18feb45d35734eae38798edb7c38cd
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Sep 11 11:16:54 2019 +0000

    re PR tree-optimization/90387 (__builtin_constant_p and -Warray-bounds
warnings)

    2019-09-11  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/90387
            * vr-values.c (vr_values::extract_range_basic): After inlining
            simplify non-constant __builtin_constant_p to false.

            * gcc.dg/Warray-bounds-44.c: New testcase.

    From-SVN: r275639

  parent reply	other threads:[~2021-11-29  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27  9:10 [Bug c/103451] New: crash at gcc/range-op.cc:1836 dcb314 at hotmail dot com
2021-11-27 11:14 ` [Bug ipa/103451] [12 Regression] crash at gcc/range-op.cc:1836 since r12-5531-g1b0acc4b800b589a marxin at gcc dot gnu.org
2021-11-29  7:36 ` rguenth at gcc dot gnu.org
2021-11-29  8:12 ` pinskia at gcc dot gnu.org
2021-11-29  8:49 ` aldyh at gcc dot gnu.org [this message]
2021-11-29  9:03 ` rguenther at suse dot de
2021-11-29  9:31 ` aldyh at gcc dot gnu.org
2021-11-30  8:53 ` aldyh at gcc dot gnu.org
2021-11-30 10:23 ` cvs-commit at gcc dot gnu.org
2021-11-30 10:23 ` aldyh at gcc dot gnu.org
2021-11-30 11:17 ` aldyh at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103451-4-8Nw526skSF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).