public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565
@ 2023-11-12  8:50 141242068 at smail dot nju.edu.cn
  2023-11-12 10:12 ` [Bug ipa/112487] [14 Regression] " xry111 at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-11-12  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112487
           Summary: GCC: 14: internal compiler error: in
                    setup_one_parameter, at tree-inline.cc:3565
           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: ---

Compiler explorer: https://gcc.godbolt.org/z/fjErPvrvP

When compile this program with `gcc-14 -O1`, gcc crashes:
```
struct A { char i; };
struct B {
  struct C *p;
  struct A *q;
};
struct C { struct B a[1]; };
struct T { struct U *ptr; };

volatile struct T v;
void f1(volatile struct T v) { f2(v); }
void f2(volatile struct T *const v) { }
void bar() {
  struct U *ptr;
  f1(v);
}
```

The crash output pasted from compiler explorer:
```
<source>: In function 'f1':
<source>:10:32: warning: implicit declaration of function 'f2'; did you mean
'f1'? [-Wimplicit-function-declaration]
   10 | void f1(volatile struct T v) { f2(v); }
      |                                ^~
      |                                f1
<source>: At top level:
<source>:11:6: warning: conflicting types for 'f2'; have 'void(volatile struct
T * const)'
   11 | void f2(volatile struct T *const v) { }
      |      ^~
<source>:10:32: note: previous implicit declaration of 'f2' with type
'void(volatile struct T * const)'
   10 | void f1(volatile struct T v) { f2(v); }
      |                                ^~
during IPA pass: inline
<source>: In function 'f1':
<source>:10:32: internal compiler error: in setup_one_parameter, at
tree-inline.cc:3565
   10 | void f1(volatile struct T v) { f2(v); }
      |                                ^~~~~
0x238b15e internal_error(char const*, ...)
        ???:0
0xa11270 fancy_abort(char const*, int, char const*)
        ???:0
0x11c5051 optimize_inline_calls(tree_node*)
        ???:0
0xe69aeb inline_transform(cgraph_node*)
        ???:0
0xfec7fb execute_all_ipa_transforms(bool)
        ???:0
0xbfe2d9 cgraph_node::expand()
        ???:0
0xc027bb 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] 6+ messages in thread

* [Bug ipa/112487] [14 Regression] internal compiler error: in setup_one_parameter, at tree-inline.cc:3565
  2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
@ 2023-11-12 10:12 ` xry111 at gcc dot gnu.org
  2023-11-12 19:27 ` [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-12 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types
  2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
  2023-11-12 10:12 ` [Bug ipa/112487] [14 Regression] " xry111 at gcc dot gnu.org
@ 2023-11-12 19:27 ` pinskia at gcc dot gnu.org
  2023-11-13  8:27 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-12 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.5.0
            Summary|[14 Regression] internal    |[11/12/13/14 Regression]
                   |compiler error: in          |ICE in setup_one_parameter
                   |setup_one_parameter, at     |with conflicting types
                   |tree-inline.cc:3565         |
             Status|UNCONFIRMED                 |NEW
   Target Milestone|14.0                        |11.5
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-12
      Known to fail|                            |10.1.0, 11.1.0, 13.2.0

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

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

* [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types
  2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
  2023-11-12 10:12 ` [Bug ipa/112487] [14 Regression] " xry111 at gcc dot gnu.org
  2023-11-12 19:27 ` [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types pinskia at gcc dot gnu.org
@ 2023-11-13  8:27 ` rguenth at gcc dot gnu.org
  2023-11-13 14:01 ` cvs-commit at gcc dot gnu.org
  2023-11-13 14:10 ` [Bug ipa/112487] [11/12/13 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-13  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's technically invalid code, we are passing an aggregate value 'v' (volatile
qualified) to a function with pointer type, so the assert

3561      /* If the value of argument is never used, don't care about
initializing
3562         it.  */
3563      if (optimize && gimple_in_ssa_p (cfun) && !def && is_gimple_reg (p))
3564        {
3565          gcc_assert (!value || !TREE_SIDE_EFFECTS (value));
3566          return insert_init_debug_bind (id, bb, var, rhs, NULL);

fires.  But when p is a register the argument can never have side-effects
unless
there's a gross type mismatch.  We instead should refrain from adding a
debug bind when such type mismatch occurs and not assert.

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

* [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types
  2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
                   ` (2 preceding siblings ...)
  2023-11-13  8:27 ` rguenth at gcc dot gnu.org
@ 2023-11-13 14:01 ` cvs-commit at gcc dot gnu.org
  2023-11-13 14:10 ` [Bug ipa/112487] [11/12/13 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-13 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:5021fa7076acd5a987362c8695ae3ebeff877d02

commit r14-5392-g5021fa7076acd5a987362c8695ae3ebeff877d02
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 13 09:24:08 2023 +0100

    middle-end/112487 - inline and parameter mismatch

    When passing an aggregate to a implicitly declared function that's
    later declared as receiving a register type we can run into a
    sanity assert that cannot hold for such gross mismatches.  Instead
    of asserting avoid emitting a debug temp that's invalid.

            PR middle-end/112487
            * tree-inline.cc (setup_one_parameter): When the parameter
            is unused only insert a debug bind when there's not a gross
            mismatch in value and declared parameter type.  Do not assert
            there effectively isn't.

            * gcc.dg/torture/pr112487.c: New testcase.

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

* [Bug ipa/112487] [11/12/13 Regression] ICE in setup_one_parameter with conflicting types
  2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
                   ` (3 preceding siblings ...)
  2023-11-13 14:01 ` cvs-commit at gcc dot gnu.org
@ 2023-11-13 14:10 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-13 14:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |14.0
            Summary|[11/12/13/14 Regression]    |[11/12/13 Regression] ICE
                   |ICE in setup_one_parameter  |in setup_one_parameter with
                   |with conflicting types      |conflicting types
           Priority|P3                          |P2

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar, not sure if worth backporting.

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

end of thread, other threads:[~2023-11-13 14:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12  8:50 [Bug c/112487] New: GCC: 14: internal compiler error: in setup_one_parameter, at tree-inline.cc:3565 141242068 at smail dot nju.edu.cn
2023-11-12 10:12 ` [Bug ipa/112487] [14 Regression] " xry111 at gcc dot gnu.org
2023-11-12 19:27 ` [Bug ipa/112487] [11/12/13/14 Regression] ICE in setup_one_parameter with conflicting types pinskia at gcc dot gnu.org
2023-11-13  8:27 ` rguenth at gcc dot gnu.org
2023-11-13 14:01 ` cvs-commit at gcc dot gnu.org
2023-11-13 14:10 ` [Bug ipa/112487] [11/12/13 " 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).