public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr
@ 2021-07-16 20:42 cnsun at uwaterloo dot ca
  2021-08-22  4:42 ` [Bug c/101478] [10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-07-16 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101478
           Summary: ICE on invalid code:
                    recompute_tree_invariant_for_addr_expr
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

This might be a duplicate of PR 84244. But that issue has a fortran test
program.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210716 (experimental) [master revision
:2c298de71:d97d71a1989e9ee8e1b8563b351c42b7732da108] (GCC)

$ cat mutant.c
struct obj {
  int n;
  list l;
} main() {
  obj o = (struct obj *)((char *)({ 1; }) - (char *)&((struct obj *)0)->l);
}

$ gcc-trunk  mutant.c
mutant.c:3:3: error: unknown type name ‘list’
    3 |   list l;
      |   ^~~~
mutant.c: In function ‘main’:
mutant.c:5:3: error: unknown type name ‘obj’; use ‘struct’ keyword to refer to
the type
    5 |   obj o = (struct obj *)((char *)({ 1; }) - (char *)&((struct obj
*)0)->l);
      |   ^~~
      |   struct
mutant.c:5:26: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
    5 |   obj o = (struct obj *)((char *)({ 1; }) - (char *)&((struct obj
*)0)->l);
      |                          ^
mutant.c:5:11: warning: initialization of ‘int’ from ‘struct obj *’ makes
integer from pointer without a cast [-Wint-conversion]
    5 |   obj o = (struct obj *)((char *)({ 1; }) - (char *)&((struct obj
*)0)->l);
      |           ^
mutant.c:5:11: internal compiler error: in
recompute_tree_invariant_for_addr_expr, at tree.c:4795
    5 |   obj o = (struct obj *)((char *)({ 1; }) - (char *)&((struct obj
*)0)->l);
      |          
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x7d4928 recompute_tree_invariant_for_addr_expr(tree_node*)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/tree.c:4795
0xc58424 gimplify_addr_expr
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:6239
0xc4ae1f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14257
0xc4a55b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14515
0xc4a55b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14515
0xc56f4f gimplify_modify_expr
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:5807
0xc4a2e0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14210
0xc4dcca gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:6869
0xc51057 gimplify_and_add(tree_node*, gimple**)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:494
0xc51057 gimplify_decl_expr
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:1831
0xc4ae06 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14407
0xc4dcca gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:6869
0xc4e4fe gimplify_bind_expr
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:1426
0xc4b4dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:14411
0xc4dcca gimplify_stmt(tree_node**, gimple**)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:6869
0xc4f2f3 gimplify_body(tree_node*, bool)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:15443
0xc4f741 gimplify_function_tree(tree_node*)
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/gimplify.c:15597
0xaa2467 cgraph_node::analyze()
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/cgraphunit.c:670
0xaa5341 analyze_functions
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xaa5e21 symbol_table::finalize_compilation_unit()
        /tmp/tmp.K5cVOXlrxH-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c/101478] [10/11/12 Regression] ICE on invalid code: recompute_tree_invariant_for_addr_expr
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
@ 2021-08-22  4:42 ` pinskia at gcc dot gnu.org
  2022-01-09  0:36 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22  4:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.4.0
   Last reconfirmed|                            |2021-08-22
   Target Milestone|---                         |10.0
            Summary|ICE on invalid code:        |[10/11/12 Regression] ICE
                   |recompute_tree_invariant_fo |on invalid code:
                   |r_addr_expr                 |recompute_tree_invariant_fo
                   |                            |r_addr_expr
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c/101478] [10/11/12 Regression] ICE on invalid code: recompute_tree_invariant_for_addr_expr
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
  2021-08-22  4:42 ` [Bug c/101478] [10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-09  0:36 ` pinskia at gcc dot gnu.org
  2022-01-20 12:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-09  0:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.0                        |10.4

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

* [Bug c/101478] [10/11/12 Regression] ICE on invalid code: recompute_tree_invariant_for_addr_expr
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
  2021-08-22  4:42 ` [Bug c/101478] [10/11/12 Regression] " pinskia at gcc dot gnu.org
  2022-01-09  0:36 ` pinskia at gcc dot gnu.org
@ 2022-01-20 12:47 ` rguenth at gcc dot gnu.org
  2022-06-28 10:45 ` [Bug c/101478] [10/11/12/13 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug c/101478] [10/11/12/13 Regression] ICE on invalid code: recompute_tree_invariant_for_addr_expr
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2022-01-20 12:47 ` rguenth at gcc dot gnu.org
@ 2022-06-28 10:45 ` jakub at gcc dot gnu.org
  2023-07-07 10:40 ` [Bug c/101478] [11/12/13/14 " rguenth at gcc dot gnu.org
  2024-03-23 20:14 ` [Bug c/101478] [11/12/13/14 Regression] ICE with statement expression and offsetof like expression pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c/101478] [11/12/13/14 Regression] ICE on invalid code: recompute_tree_invariant_for_addr_expr
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2022-06-28 10:45 ` [Bug c/101478] [10/11/12/13 " jakub at gcc dot gnu.org
@ 2023-07-07 10:40 ` rguenth at gcc dot gnu.org
  2024-03-23 20:14 ` [Bug c/101478] [11/12/13/14 Regression] ICE with statement expression and offsetof like expression pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug c/101478] [11/12/13/14 Regression] ICE with statement expression and offsetof like expression
  2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2023-07-07 10:40 ` [Bug c/101478] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-23 20:14 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13/14 Regression]
                   |ICE on invalid code:        |ICE with statement
                   |recompute_tree_invariant_fo |expression and offsetof
                   |r_addr_expr                 |like expression
           Priority|P4                          |P3
           Keywords|error-recovery,             |ice-on-valid-code
                   |ice-on-invalid-code         |

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You can make this valid (maybe not runtime defined) GNU C code that ICEs in the
same way:
```
struct obj {
  int n;
  int l;
};
int main() {
  (struct obj *)((char *)(__SIZE_TYPE__)({ 0; }) - (char *)&((struct obj
*)0)->l);
}

```

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

end of thread, other threads:[~2024-03-23 20:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 20:42 [Bug c/101478] New: ICE on invalid code: recompute_tree_invariant_for_addr_expr cnsun at uwaterloo dot ca
2021-08-22  4:42 ` [Bug c/101478] [10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-09  0:36 ` pinskia at gcc dot gnu.org
2022-01-20 12:47 ` rguenth at gcc dot gnu.org
2022-06-28 10:45 ` [Bug c/101478] [10/11/12/13 " jakub at gcc dot gnu.org
2023-07-07 10:40 ` [Bug c/101478] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-23 20:14 ` [Bug c/101478] [11/12/13/14 Regression] ICE with statement expression and offsetof like expression pinskia 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).