public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "141242068 at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-111922-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            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 = v.wi->w) || (v.a = v.wi->w);
  f2();
}

static void f3(int wi, int c) {
  int b = 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-style
function declaration. If it is converted to the modern style, the crash doesn'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:
```
<source>: In function 'f3':
<source>:15:3: warning: implicit declaration of function 'fn4'
[-Wimplicit-function-declaration]
   15 |   fn4(0, 0, v.a);
      |   ^~~
during IPA pass: cp
<source>: At top level:
<source>: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<wide_int_storage> const&, generic_wide_int<wide_int_storage>
const&, generic_wide_int<wide_int_storage> const&,
generic_wide_int<wide_int_storage> const&) const
        ???:0
0x1037b64 range_operator::fold_range(irange&, tree_node*, irange const&, irange
const&, relation_trio) const
        ???:0
0x1023768 operator_bitwise_not::fold_range(irange&, tree_node*, irange const&,
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 <https://gcc.gnu.org/bugs/> for instructions.
```

             reply	other threads:[~2023-10-22 16:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 16:38 141242068 at smail dot nju.edu.cn [this message]
2023-10-22 16:39 ` [Bug c/111922] " 141242068 at smail dot nju.edu.cn
2023-10-22 16:41 ` [Bug ipa/111922] [11/12/13/14 Regression] ICE in cp with -O2 -fno-tree-fre pinskia at gcc dot gnu.org
2023-10-23 16:51 ` jamborm at gcc dot gnu.org
2023-11-22 14:27 ` jakub at gcc dot gnu.org
2023-11-22 16:25 ` amacleod at redhat dot com
2023-11-22 16:32 ` jakub at gcc dot gnu.org
2023-11-22 17:29 ` amacleod at redhat dot com
2023-11-22 17:34 ` jakub at gcc dot gnu.org
2023-11-22 17:42 ` amacleod at redhat dot com
2023-11-29 16:51 ` cvs-commit at gcc dot gnu.org
2023-11-29 16:52 ` amacleod at redhat dot com
2023-11-29 23:22 ` sjames at gcc dot gnu.org
2023-11-30 18:31 ` amacleod at redhat dot com

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-111922-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).