public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code @ 2023-02-24 5:26 saifi.khan at nishan dot io 2023-02-24 7:00 ` [Bug debug/108917] ICE when specifying optimization level and debuging " pinskia at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: saifi.khan at nishan dot io @ 2023-02-24 5:26 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/108917] ICE when specifying optimization level and debuging for C++ contracts code 2023-02-24 5:26 [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code saifi.khan at nishan dot io @ 2023-02-24 7:00 ` pinskia at gcc dot gnu.org 2023-05-31 10:18 ` saifi.khan at nishan dot io ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-24 7:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108917 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed| |2023-02-24 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduced testcase: ``` [[gnu::noipa]] int f (int i) { return i + 100; } int g (int j) [[pre: f (j) < j ]] { return j; } ``` It is the inlining of the contract into g which is causing the ICE. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/108917] ICE when specifying optimization level and debuging for C++ contracts code 2023-02-24 5:26 [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code saifi.khan at nishan dot io 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 3 siblings, 0 replies; 5+ messages in thread From: saifi.khan at nishan dot io @ 2023-05-31 10:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108917 --- Comment #2 from Saifi Khan <saifi.khan at nishan dot io> --- Compiling with gcc version 14.0.0 20230531 and executing the ELF binary. coredumpctl info 239557 Coredump Stack Trace #0 0x00007f5f739b226c n/a (libc.so.6 + 0x8926c) #1 0x00007f5f73962a08 raise (libc.so.6 + 0x39a08) #2 0x00007f5f7394b538 abort (libc.so.6 + 0x22538) #3 0x00007f5f73cabc5b _ZN9__gnu_cxx27__verbose_terminate_handlerEv (libstdc++.so.6 + 0xabc5b) #4 0x00007f5f73cde50a _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xde50a) #5 0x00007f5f73cde575 _ZSt9terminatev (libstdc++.so.6 + 0xde575) #6 0x0000560c5dc3b7c8 _Z1gi (a.out + 0x17c8) #7 0x0000560c5dc3b73d _Z1gi (a.out + 0x173d) #8 0x0000560c5dc3b7d8 _Z4testv (a.out + 0x17d8) #9 0x0000560c5dc3b7e4 main (a.out + 0x17e4) #10 0x00007f5f7394c850 n/a (libc.so.6 + 0x23850) #11 0x00007f5f7394c90a __libc_start_main (libc.so.6 + 0x2390a) #12 0x0000560c5dc3b655 _start (a.out + 0x1655) ELF object binary architecture: AMD x86-64 coredumpctl gdb ./a.out [New LWP 239557] [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Core was generated by `./a.out'. Program terminated with signal SIGABRT, Aborted. #0 0x00007f5f739b226c in ?? () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007f5f739b226c in ?? () from /usr/lib/libc.so.6 #1 0x00007f5f73962a08 in raise () from /usr/lib/libc.so.6 #2 0x00007f5f7394b538 in abort () from /usr/lib/libc.so.6 #3 0x00007f5f73cabc5b in __gnu_cxx::__verbose_terminate_handler () at /opt/gcc/src/libstdc++-v3/libsupc++/vterminate.cc:95 #4 0x00007f5f73cde50a in __cxxabiv1::__terminate (handler=<optimized out>) at /opt/gcc/src/libstdc++-v3/libsupc++/eh_terminate.cc:48 #5 0x00007f5f73cde575 in std::terminate () at /opt/gcc/src/libstdc++-v3/libsupc++/eh_terminate.cc:58 #6 0x0000560c5dc3b7c8 in g (j=<optimized out>, j=<optimized out>) at contract_01.cc:13 #7 0x0000560c5dc3b73d in g (j=5) at contract_01.cc:8 #8 0x0000560c5dc3b7d8 in test () at contract_01.cc:18 #9 0x0000560c5dc3b7e4 in main () at contract_01.cc:26 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/108917] ICE when specifying optimization level and debuging for C++ contracts code 2023-02-24 5:26 [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code saifi.khan at nishan dot io 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-23 18:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108917 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ville.voutilainen at gmail dot com --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 115601 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/108917] ICE when specifying optimization level and debuging for C++ contracts code 2023-02-24 5:26 [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code saifi.khan at nishan dot io ` (2 preceding siblings ...) 2024-06-23 18:29 ` pinskia at gcc dot gnu.org @ 2024-06-23 20:44 ` iains at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: iains at gcc dot gnu.org @ 2024-06-23 20:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108917 --- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> --- I think the problem here is related to the setting of DECL_ABSTRACT_ORIGIN on the contract checking functions. " DECL_ABSTRACT_ORIGIN, if non-NULL, points to the original (abstract) ..._DECL node of which this decl is an (inlined or template expanded) instance. " but that is not what these synthesised functions are; rather they are entirely new functions that implement a series of tests and possibly diagnostic output. In fact, they don't necessarily even have the same signature as the original. They certainly do not have the same block layout as the original. It's not clear that we need these functions to be identified as the same function as the original (if that is really a requirement - e.g. to make the function name the same in these helpers - then we could do a similar process to the one used for coroutine helpers). ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-23 20:44 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-24 5:26 [Bug c++/108917] New: ICE when specifying optimization level for C++ contracts code saifi.khan at nishan dot io 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
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).