public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/105604] New: [10/11/12 Regression] ICE: in tree_to_shwi, at tree.cc:6369
@ 2022-05-14 20:20 slyfox at gcc dot gnu.org
  2022-05-14 20:26 ` [Bug middle-end/105604] [10/11/12 Regression] ICE: in tree_to_shwi with vla in struct and sprintf pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-05-14 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105604
           Summary: [10/11/12 Regression] ICE: in tree_to_shwi, at
                    tree.cc:6369
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Originally reported by cpu in https://bugs.gentoo.org/844091. Here is my
attempt at minimizing it:

//$ cat main.c
struct {
  long users;
  long size;
  char *data;
} * main_trans;
void *main___trans_tmp_1;
int sprintf(char *, char *, ...);
int main() {
  int users = 0;
  struct {
    long users;
    long size;
    char *data;
    int links[users];
    char buf[];
  } *trans = trans;
  trans->data = trans->buf;
  main___trans_tmp_1 = trans;
  main_trans = main___trans_tmp_1;
  sprintf(main_trans->data, "test");
}


$ /tmp/gb/gcc/xgcc -B/tmp/gb/gcc -c -Wall -O2 -pipe -fomit-frame-pointer main.c
during GIMPLE pass: strlen
main.c: In function ‘main’:
main.c:8:5: internal compiler error: in tree_to_shwi, at tree.cc:6369
    8 | int main() {
      |     ^~~~
0x1116ade tree_to_shwi(tree_node const*)
        gcc/tree.cc:6369
0x1116b36 int_byte_position(tree_node const*)
        gcc/tree.cc:3616
0x1cd1ce8 get_origin_and_offset_r
        gcc/gimple-ssa-sprintf.cc:2354
0x1cd1845 get_origin_and_offset_r
        gcc/gimple-ssa-sprintf.cc:2307
0x1cd1f29 get_origin_and_offset_r
        gcc/gimple-ssa-sprintf.cc:2370
0x1cd64ce get_origin_and_offset
        gcc/gimple-ssa-sprintf.cc:2427
0x1cd64ce handle_printf_call(gimple_stmt_iterator*, pointer_query&)
        gcc/gimple-ssa-sprintf.cc:4703
0x103ff10 strlen_pass::check_and_optimize_call(bool*)
        gcc/tree-ssa-strlen.cc:5461
0x103ffb3 strlen_pass::check_and_optimize_stmt(bool*)
        gcc/tree-ssa-strlen.cc:5665
0x1040326 strlen_pass::before_dom_children(basic_block_def*)
        gcc/tree-ssa-strlen.cc:5849
0x1c5d56b dom_walker::walk(basic_block_def*)
        gcc/domwalk.cc:309
0x10409cf printf_strlen_execute
        gcc/tree-ssa-strlen.cc:5908
0x1040c58 execute
        gcc/tree-ssa-strlen.cc:6007

I seem to be able to reproduce ICE on: 10.3.0, 11.3.0, 12.1.0.
This does not ICE: 9.3.0

$ /tmp/gb/gcc/xgcc -B/tmp/gb/gcc -v

Reading specs from /tmp/gb/gcc/specs
COLLECT_GCC=/tmp/gb/gcc/xgcc
COLLECT_LTO_WRAPPER=/tmp/gb/gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap
--with-native-system-header-dir=/<<NIX>>/glibc-2.34-115-dev/include
--prefix=/tmp/gb/__td__ CFLAGS='-O1 -ggdb3' CXXFLAGS='-O1 -ggdb3' LDFLAGS='-O1
-ggdb3'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220514 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-14 20:20 [Bug middle-end/105604] New: [10/11/12 Regression] ICE: in tree_to_shwi, at tree.cc:6369 slyfox at gcc dot gnu.org
2022-05-14 20:26 ` [Bug middle-end/105604] [10/11/12 Regression] ICE: in tree_to_shwi with vla in struct and sprintf pinskia at gcc dot gnu.org
2022-05-16  7:09 ` [Bug middle-end/105604] [10/11/12/13 " marxin at gcc dot gnu.org
2022-05-16  7:56 ` rguenth at gcc dot gnu.org
2022-05-24 22:20 ` cvs-commit at gcc dot gnu.org
2022-05-24 22:22 ` [Bug middle-end/105604] [10/11/12 " msebor at gcc dot gnu.org
2022-06-02  9:39 ` cvs-commit at gcc dot gnu.org
2022-06-15  8:02 ` [Bug middle-end/105604] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-19 11:39 ` rguenth at gcc dot gnu.org
2023-07-07 10:43 ` [Bug middle-end/105604] [11 " rguenth 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).