public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111818] New: GCC: 14: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'integer_cst' in tree_could_trap_p, at tree-eh.cc:2733
@ 2023-10-15  1:38 141242068 at smail dot nju.edu.cn
  2023-10-15  1:47 ` [Bug middle-end/111818] [11/12/13/14 Regression] ICE with __builtin_memcpy with volatile and constants pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-15  1:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111818
           Summary: GCC: 14: internal compiler error: tree check: expected
                    tree that contains 'decl common' structure, have
                    'integer_cst' in tree_could_trap_p, at tree-eh.cc:2733
           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: ---

When compile below program with GCC-14 and option `-O1`, GCC-14 crashes:
```
#define DUMMY_VALUE 0x12345678
static void foo(const volatile unsigned int x, void *p) {
  __builtin_memcpy(p, &x, sizeof x);
  __builtin_memcpy(p, &x, sizeof x);
}

void bar(int type, void *number) {
  switch (type) {
  case 1: foo(DUMMY_VALUE, number); break;
  case 7: foo(0, number); break;
  case 8: foo(0, number); break;
  case 9: foo(0, number); break;
  }
}
```

The crash reproducer: https://godbolt.org/z/7sP8zc3Kc

And the full stack dump:
```
<source>: In function 'foo':
<source>:3:23: warning: passing argument 2 of '__builtin_memcpy' discards
'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
    3 |   __builtin_memcpy(p, &x, sizeof x);
      |                       ^~
<source>:3:23: note: expected 'const void *' but argument is of type 'const
volatile unsigned int *'
<source>:4:23: warning: passing argument 2 of '__builtin_memcpy' discards
'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
    4 |   __builtin_memcpy(p, &x, sizeof x);
      |                       ^~
<source>:4:23: note: expected 'const void *' but argument is of type 'const
volatile unsigned int *'
during RTL pass: expand
In function 'foo',
    inlined from 'bar' at <source>:9:11:
<source>:3:3: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'integer_cst' in tree_could_trap_p, at
tree-eh.cc:2733
    3 |   __builtin_memcpy(p, &x, sizeof x);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x22ff3ee internal_error(char const*, ...)
        ???:0
0x8a8243 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xc9ab0e set_mem_attributes_minus_bitpos(rtx_def*, tree_node*, int,
poly_int<1u, long>)
        ???:0
0xcc6c35 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xcd3083 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ???:0
0xcd4d66 expand_assignment(tree_node*, tree_node*, bool)
        ???: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.
```

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

end of thread, other threads:[~2023-12-15 12:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-15  1:38 [Bug c/111818] New: GCC: 14: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'integer_cst' in tree_could_trap_p, at tree-eh.cc:2733 141242068 at smail dot nju.edu.cn
2023-10-15  1:47 ` [Bug middle-end/111818] [11/12/13/14 Regression] ICE with __builtin_memcpy with volatile and constants pinskia at gcc dot gnu.org
2023-10-16  6:59 ` rguenth at gcc dot gnu.org
2023-10-17  6:26 ` cvs-commit at gcc dot gnu.org
2023-10-17  6:27 ` [Bug middle-end/111818] [11/12/13 " rguenth at gcc dot gnu.org
2023-11-10 14:24 ` cvs-commit at gcc dot gnu.org
2023-11-27 13:09 ` [Bug middle-end/111818] [11/12 " cvs-commit at gcc dot gnu.org
2023-12-15 12:18 ` [Bug middle-end/111818] [11 " cvs-commit at gcc dot gnu.org
2023-12-15 12:22 ` 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).