public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/99309] [10/11 Regression] Segmentation fault with __builtin_constant_p usage at -O2
Date: Mon, 01 Mar 2021 09:44:49 +0000	[thread overview]
Message-ID: <bug-99309-4-jdKwdl3qv9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99309-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase without headers:

struct T {
  int val;
  explicit constexpr operator int() const { return val; }
  constexpr T(long v):val(v){}
  void operator*=(T m) {
    if(__builtin_constant_p(m.val)){
      __builtin_printf ("normal\n");
      return;
    }else if(__builtin_constant_p(val)){
      __builtin_printf ("recursive\n");
      return;
    }else{
      __builtin_printf ("return\n");
      return;
    }
  }
};


int main(){
  T constexpr step=610334368;
  T value=1;
  for(int _=0; _<100; ++_){
    __builtin_printf ("%d %d\n", (int) value, (int) step);
    value*=step;
    __builtin_printf ("%d %d\n", (int) value, (int) step);
  }
}

Bet yet another IPA/inlining bug, like e.g. PR98834, the __builtin_unreachable
call is added during inlining:
Introduced new external node (void __builtin_unreachable()/11).

  parent reply	other threads:[~2021-03-01  9:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 10:33 [Bug c++/99309] New: " gcc at mailinator dot com
2021-03-01  9:31 ` [Bug c++/99309] [10/11 Regression] " rguenth at gcc dot gnu.org
2021-03-01  9:44 ` jakub at gcc dot gnu.org [this message]
2021-03-08 15:45 ` [Bug ipa/99309] " mpolacek at gcc dot gnu.org
2021-03-29 14:07 ` jakub at gcc dot gnu.org
2021-03-31 18:18 ` hubicka at gcc dot gnu.org
2021-03-31 18:29 ` jakub at gcc dot gnu.org
2021-03-31 18:46 ` hubicka at ucw dot cz
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-15  9:49 ` hubicka at gcc dot gnu.org
2022-03-24 13:59 ` [Bug ipa/99309] [10/11/12 " rguenth at gcc dot gnu.org
2022-06-28 10:43 ` [Bug ipa/99309] [10/11/12/13 " jakub at gcc dot gnu.org
2023-07-07 10:39 ` [Bug ipa/99309] [11/12/13/14 " rguenth at gcc dot gnu.org
2023-08-17  0:19 ` pinskia 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-99309-4-jdKwdl3qv9@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).