public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771
@ 2023-07-16 10:57 141242068 at smail dot nju.edu.cn
  2023-11-13 19:17 ` [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-07-16 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110682
           Summary: GCC, ICE: internal compiler error: in gimplify_expr,
                    at gimplify.cc:16771
           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 compiling below program using gcc-14 with option `gcc-14 -Ofast a.c`,
gcc-14 crashes:
```
struct a {
  const signed char b;
};

void f(volatile struct a *c) {
  c - 0 % c->b;
  struct a c = {1};
}
```

GCC's output is pasted below:
```
<source>: In function 'f':
<source>:7:12: error: 'c' redeclared as different kind of symbol
    7 |   struct a c = {1};
      |            ^
<source>:5:27: note: previous definition of 'c' with type 'volatile struct a *'
    5 | void f(volatile struct a *c) {
      |        ~~~~~~~~~~~~~~~~~~~^
<source>:6:5: internal compiler error: in gimplify_expr, at gimplify.cc:16771
    6 |   c - 0 % c->b;
      |   ~~^~~~~~~~~~
0x2150dee internal_error(char const*, ...)
        ???:0
0x9ce06c fancy_abort(char const*, int, char const*)
        ???:0
0xd7057a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6d9ba gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7057a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6e4eb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7057a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6d954 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7057a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd71a13 gimplify_body(tree_node*, bool)
        ???:0
0xd71e6f gimplify_function_tree(tree_node*)
        ???:0
0xbaebe7 cgraph_node::analyze()
        ???:0
0xbb2731 symbol_table::finalize_compilation_unit()
        ???: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.
```

This can be verified by visiting the Compiler Explorer:
https://gcc.godbolt.org/z/5951jvono

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
@ 2023-11-13 19:17 ` pinskia at gcc dot gnu.org
  2023-12-05 22:58 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-13 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-11-13
     Ever confirmed|0                           |1
            Summary|GCC, ICE: internal compiler |[12/13/14 Regression] ICE:
                   |error: in gimplify_expr, at |internal compiler error: in
                   |gimplify.cc:16771           |gimplify_expr after error

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

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
  2023-11-13 19:17 ` [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error pinskia at gcc dot gnu.org
@ 2023-12-05 22:58 ` pinskia at gcc dot gnu.org
  2024-03-07 23:29 ` law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-05 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.4
      Known to work|                            |11.1.0, 11.4.0
      Known to fail|                            |12.1.0

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
  2023-11-13 19:17 ` [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error pinskia at gcc dot gnu.org
  2023-12-05 22:58 ` pinskia at gcc dot gnu.org
@ 2024-03-07 23:29 ` law at gcc dot gnu.org
  2024-03-07 23:31 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P1

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
                   ` (2 preceding siblings ...)
  2024-03-07 23:29 ` law at gcc dot gnu.org
@ 2024-03-07 23:31 ` pinskia at gcc dot gnu.org
  2024-03-08  3:43 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-07 23:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I will take a look

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
                   ` (3 preceding siblings ...)
  2024-03-07 23:31 ` pinskia at gcc dot gnu.org
@ 2024-03-08  3:43 ` pinskia at gcc dot gnu.org
  2024-03-12 13:24 ` jakub at gcc dot gnu.org
  2024-03-23  5:51 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-08  3:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This fixes the ICE:
```
[apinski@xeond2 gcc]$ git diff
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 6ebca964cb2..0f43324fb35 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -17681,7 +17681,11 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p,
       save_expr = *expr_p;

       /* Die, die, die, my darling.  */
-      if (error_operand_p (save_expr))
+      if (error_operand_p (save_expr)
+         /* The above strip useless type conversion might not strip out
+            a conversion from an error so handle that case here.  */
+         || (TREE_CODE (save_expr) == NON_LVALUE_EXPR
+             && error_operand_p (TREE_OPERAND (save_expr, 0))))
        {
          ret = GS_ERROR;
          break;

```

I will submit it tomorrow once I test it fully.

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
                   ` (4 preceding siblings ...)
  2024-03-08  3:43 ` pinskia at gcc dot gnu.org
@ 2024-03-12 13:24 ` jakub at gcc dot gnu.org
  2024-03-23  5:51 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-12 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12-13 has been released with this bug, so P2.

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

* [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error
  2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
                   ` (5 preceding siblings ...)
  2024-03-12 13:24 ` jakub at gcc dot gnu.org
@ 2024-03-23  5:51 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23  5:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-March/648270.html

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-16 10:57 [Bug c/110682] New: GCC, ICE: internal compiler error: in gimplify_expr, at gimplify.cc:16771 141242068 at smail dot nju.edu.cn
2023-11-13 19:17 ` [Bug c/110682] [12/13/14 Regression] ICE: internal compiler error: in gimplify_expr after error pinskia at gcc dot gnu.org
2023-12-05 22:58 ` pinskia at gcc dot gnu.org
2024-03-07 23:29 ` law at gcc dot gnu.org
2024-03-07 23:31 ` pinskia at gcc dot gnu.org
2024-03-08  3:43 ` pinskia at gcc dot gnu.org
2024-03-12 13:24 ` jakub at gcc dot gnu.org
2024-03-23  5:51 ` 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).