public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "saifi.khan at nishan dot io" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code
Date: Fri, 24 Feb 2023 05:26:10 +0000	[thread overview]
Message-ID: <bug-108917-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108917
           Summary: ICE when specifying optimization level for C++
                    contracts code
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saifi.khan at nishan dot io
  Target Milestone: ---

Environment
 - Linux  6.1.0-3-amd64 x86_64 GNU/Linux
 - Debian GLIBC 2.36-8) 2.36
 - gcc version 13.0.1 20230215 (experimental) (GCC)

was working through p2680r1 example with the code as follows.

---
auto f (int i) -> int {
      return i + 100;
}

int g (int j) [[pre: f (j) < j ]] {
      int r { j - f (j)};
      return 2 * r;
}

auto test () -> void {
      g (5);
}

---

::  g++ -std=c++23 -fcontracts contract_01.cc 
::  ./a.out 
contract violation in function g at contract_01.cc:8: f (j) < j
terminate called without an active exception
Aborted
::  

But this doesn't work !

::  g++ -std=c++23 -O3 -g2 -fcontracts contract_01.cc 
during RTL pass: final
contract_01.cc: In function ‘int g(int)’:
contract_01.cc:13:1: internal compiler error: in gen_inlined_subroutine_die, at
dwarf2out.cc:25002
   13 | }
      | ^
0x7d40a5 gen_inlined_subroutine_die
        /opt/gcc/src/gcc/dwarf2out.cc:25002
0x7d40a5 gen_block_die
        /opt/gcc/src/gcc/dwarf2out.cc:26487
0xe3b3ca decls_for_scope
        /opt/gcc/src/gcc/dwarf2out.cc:26612
0xe18c93 gen_subprogram_die
        /opt/gcc/src/gcc/dwarf2out.cc:24086
0xe1d82f gen_decl_die
        /opt/gcc/src/gcc/dwarf2out.cc:27020
0xe1e60a dwarf2out_decl
        /opt/gcc/src/gcc/dwarf2out.cc:27598
0xe1ea62 dwarf2out_function_decl
        /opt/gcc/src/gcc/dwarf2out.cc:27613
0xea23e7 rest_of_handle_final
        /opt/gcc/src/gcc/final.cc:4274
0xea23e7 execute
        /opt/gcc/src/gcc/final.cc:4318
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

             reply	other threads:[~2023-02-24  5:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  5:26 saifi.khan at nishan dot io [this message]
2023-02-24  7:00 ` [Bug debug/108917] ICE when specifying optimization level and debuging " pinskia at gcc dot gnu.org
2023-05-31 10:18 ` saifi.khan at nishan dot io
2024-06-23 18:29 ` pinskia at gcc dot gnu.org
2024-06-23 20:44 ` iains 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-108917-4@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).