public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100409] New: C++ FE elides pure throwing call Date: Tue, 04 May 2021 06:45:51 +0000 [thread overview] Message-ID: <bug-100409-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100409 Bug ID: 100409 Summary: C++ FE elides pure throwing call Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- The C++ FE elides the call to foo() in int x, y; int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; } void __attribute__((noinline)) foo2 () { foo (); } despite it throwing an exception. It does this in finish_expr_stmt by calling convert_to_void on the following, likely relying on !TREE_SIDE_EFFECTS <call_expr 0x7ffff66dca20 type <integer_type 0x7ffff65885e8 int public type_6 SI size <integer_cst 0x7ffff658b108 constant 32> unit-size <integer_cst 0x7ffff658b120 constant 4> align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff65885e8 precision:32 min <integer_cst 0x7ffff658b0c0 -2147483648> max <integer_cst 0x7ffff658b0d8 2147483647> pointer_to_this <pointer_type 0x7ffff65909d8>> fn <addr_expr 0x7ffff66c7be0 type <pointer_type 0x7ffff66e29d8 type <function_type 0x7ffff65989d8> unsigned DI size <integer_cst 0x7ffff656aeb8 constant 64> unit-size <integer_cst 0x7ffff656aed0 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff66e29d8> constant arg:0 <function_decl 0x7ffff66cde00 foo type <function_type 0x7ffff65989d8> addressable used public static uninlinable decl_5 QI t2.c:2:36 align:8 warn_if_not_align:0 context <translation_unit_decl 0x7ffff6578168 t2.c> attributes <tree_list 0x7ffff66c8de8 purpose <identifier_node 0x7ffff66dbe00 noinline normal local bindings <(nil)>> chain <tree_list 0x7ffff66c8dc0 purpose <identifier_node 0x7ffff65b4200 pure normal local bindings <(nil)>>>> initial <block 0x7ffff66d14e0> result <result_decl 0x7ffff6578e10 D.2349> full-name "int foo()" struct-function 0x7ffff66de000 chain <var_decl 0x7ffff7ff5c60 y>>> t2.c:3:46 start: t2.c:3:42 finish: t2.c:3:47> it happens here: if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr))) { ... expr = build1 (CONVERT_EXPR, void_type_node, expr); } if (! TREE_SIDE_EFFECTS (expr)) expr = void_node; return expr;
next reply other threads:[~2021-05-04 6:45 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-04 6:45 rguenth at gcc dot gnu.org [this message] 2021-05-04 6:46 ` [Bug c++/100409] " rguenth at gcc dot gnu.org 2021-05-05 8:02 ` rguenth at gcc dot gnu.org 2021-07-08 7:25 ` rguenth at gcc dot gnu.org 2021-07-08 8:19 ` harald at gigawatt dot nl 2021-07-08 8:38 ` rguenth at gcc dot gnu.org 2021-07-08 8:38 ` rguenth at gcc dot gnu.org 2021-07-08 8:39 ` rguenth at gcc dot gnu.org 2021-07-08 8:44 ` rguenth at gcc dot gnu.org 2021-07-08 9:17 ` harald at gigawatt dot nl 2021-07-08 9:20 ` rguenth at gcc dot gnu.org 2021-07-08 9:41 ` rguenth at gcc dot gnu.org 2021-07-08 13:15 ` mpolacek at gcc dot gnu.org 2021-07-08 13:53 ` jason at gcc dot gnu.org 2021-07-08 14:09 ` rguenth at gcc dot gnu.org 2021-07-08 15:13 ` jason at gcc dot gnu.org 2021-07-08 22:06 ` mpolacek at gcc dot gnu.org 2022-01-05 14:41 ` rguenth 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-100409-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: linkBe 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).