public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/115644] New: [gcc][trunk] ICE if redeclare a variable with different type
@ 2024-06-25 12:54 141242068 at smail dot nju.edu.cn
  2024-06-25 13:07 ` [Bug c/115644] " 141242068 at smail dot nju.edu.cn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2024-06-25 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115644
           Summary: [gcc][trunk] ICE if redeclare a variable with
                    different type
           Product: gcc
           Version: 15.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: ---

Quick verification link: https://gcc.godbolt.org/z/fdY8KqhK6

The testing program:
```
void foo ()
{
  int p[5];
  int v = *p;
  int *p = 0;
}
```

Compiling this program using gcc-trunk will trigger crash, and dump stacks as
follows:
```
0x23be10c internal_error(char const*, ...)
        ???:0
0x8948df tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ???:0
0xd120d0 gimple_fold_indirect_ref(tree_node*)
        ???:0
0xd5b8f7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd5f06a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd5c472 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd5f06a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd5c75b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd5f06a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd5bf2a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd651b3 gimplify_body(tree_node*, bool)
        ???:0
0xd655f9 gimplify_function_tree(tree_node*)
        ???:0
0xb87377 cgraph_node::analyze()
        ???:0
0xb8a6d1 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.
```

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

* [Bug c/115644] [gcc][trunk] ICE if redeclare a variable with different type
  2024-06-25 12:54 [Bug c/115644] New: [gcc][trunk] ICE if redeclare a variable with different type 141242068 at smail dot nju.edu.cn
@ 2024-06-25 13:07 ` 141242068 at smail dot nju.edu.cn
  2024-06-25 16:59 ` pinskia at gcc dot gnu.org
  2024-06-25 20:02 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2024-06-25 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from wierton <141242068 at smail dot nju.edu.cn> ---
This crash seems to be the same cause: https://gcc.godbolt.org/z/6br3xoaKG

The testing program:
```
void f()
{
  int p;
  unsigned v;
  v = (~0u) >> p;
  int p[1] = p;
}
```

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

* [Bug c/115644] [gcc][trunk] ICE if redeclare a variable with different type
  2024-06-25 12:54 [Bug c/115644] New: [gcc][trunk] ICE if redeclare a variable with different type 141242068 at smail dot nju.edu.cn
  2024-06-25 13:07 ` [Bug c/115644] " 141242068 at smail dot nju.edu.cn
@ 2024-06-25 16:59 ` pinskia at gcc dot gnu.org
  2024-06-25 20:02 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to wierton from comment #1)
> This crash seems to be the same cause: https://gcc.godbolt.org/z/6br3xoaKG

Related in the sense redeclaring the variable with a different type changes the
the underlying type of the decl to error_mark_node which the rest of the
compiler is not always ready to handle. (there a few other bug reports which
was caused by the same thing too).

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

* [Bug c/115644] [gcc][trunk] ICE if redeclare a variable with different type
  2024-06-25 12:54 [Bug c/115644] New: [gcc][trunk] ICE if redeclare a variable with different type 141242068 at smail dot nju.edu.cn
  2024-06-25 13:07 ` [Bug c/115644] " 141242068 at smail dot nju.edu.cn
  2024-06-25 16:59 ` pinskia at gcc dot gnu.org
@ 2024-06-25 20:02 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-25 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-25
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2024-06-25 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 12:54 [Bug c/115644] New: [gcc][trunk] ICE if redeclare a variable with different type 141242068 at smail dot nju.edu.cn
2024-06-25 13:07 ` [Bug c/115644] " 141242068 at smail dot nju.edu.cn
2024-06-25 16:59 ` pinskia at gcc dot gnu.org
2024-06-25 20:02 ` mpolacek 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).