From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 56F4D3858417; Sun, 22 Oct 2023 16:38:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56F4D3858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697992706; bh=NT8e5/eF+FnZAycZGNgMfLzAqC0jfiC3fDyqYb0UDls=; h=From:To:Subject:Date:From; b=RG3Mim8s3gioyU5fkIbxs59YkO/aUgO3H8QOgOdz/2Of8/GSRXzd2CQIaJ5rFtvsH 8zwZb+PQP8BFGmSsM4ESc4kVMJ0djY0zPGwbvfN+BVotVawUI2SNbxJWuK/LTRNgFw dbNSTyFhZp/f3MWJOjyQMhAJuK4fARpIBcljXW4Y= From: "141242068 at smail dot nju.edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111922] New: GCC: internal compiler error: in decompose, at wide-int.h:1049 Date: Sun, 22 Oct 2023 16:38:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 141242068 at smail dot nju.edu.cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111922 Bug ID: 111922 Summary: GCC: internal compiler error: in decompose, at wide-int.h:1049 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- Compiler Explorer: [https://gcc.godbolt.org/z/EoPGKa9r8](https://gcc.godbolt.org/z/EoPGKa9r8) The code that triggers the crash is somewhat extensive. I've attempted to minimize it, but the underlying cause seems to be complex. Here's the code: ```c void f2(void); struct T1 { int w; }; struct T2 { struct T1 *wi; int a; } v; static int f1(dpy, wi) struct T3 *dpy; struct T1 *wi; { (v.a =3D v.wi->w) || (v.a =3D v.wi->w); f2(); } static void f3(int wi, int c) { int b =3D f1(0, ~wi); fn4(0, 0, v.a); } void f5() { f3(0, 0); } ``` Compiling this program with `-O2 -fno-tree-fre` causes GCC to crash. Some interesting observations about this crash: 1. The crash only occurs when the function `f1` is declared using the old-s= tyle function declaration. If it is converted to the modern style, the crash doe= sn't occur. 2. If any statement in the code is commented out, even if it's just half of= the logic or expression inside `f1`, the crash disappears. The full stack dump: ``` : In function 'f3': :15:3: warning: implicit declaration of function 'fn4' [-Wimplicit-function-declaration] 15 | fn4(0, 0, v.a); | ^~~ during IPA pass: cp : At top level: :18:1: internal compiler error: in decompose, at wide-int.h:1049 18 | void f5() { f3(0, 0); } | ^~~~ 0x231f49e internal_error(char const*, ...) ???:0 0xa00958 fancy_abort(char const*, int, char const*) ???:0 0x103701e range_operator::wi_fold_in_parts(irange&, tree_node*, generic_wide_int const&, generic_wide_int const&, generic_wide_int const&, generic_wide_int const&) const ???:0 0x1037b64 range_operator::fold_range(irange&, tree_node*, irange const&, ir= ange const&, relation_trio) const ???:0 0x1023768 operator_bitwise_not::fold_range(irange&, tree_node*, irange cons= t&, irange const&, relation_trio) const ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. ```=