public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
@ 2023-04-11 21:52 danglin at gcc dot gnu.org
  2023-04-12 11:31 ` [Bug middle-end/109478] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: danglin at gcc dot gnu.org @ 2023-04-11 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109478
           Summary: FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal
                    compiler error: Segmentation fault)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../xg++
-B
/home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C
-fdiagnostics-plain-output -nostdinc++
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11
-I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc++-v3/include
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/include/backward
-I/home/dave/gnu/gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=0
-std=gnu++14 -fnon-call-exceptions -S -o pr104989.s
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C:6:9: warning:
width of 'a::b' exceeds its type
during RTL pass: expand
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C: In function 'void
c(...)':
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C:8:16: internal
compiler error: Segmentation fault
libbacktrace could not find executable to open
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
compiler exited with status 1
FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error:
Segmentation fault)
XFAIL: g++.dg/other/pr104989.C  -std=gnu++14 (test for excess errors)
Excess errors:
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C:6:9: warning:
width of 'a::b' exceeds its type
during RTL pass: expand
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/other/pr104989.C:8:16: internal
compiler error: Segmentation fault

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

* [Bug middle-end/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
@ 2023-04-12 11:31 ` rguenth at gcc dot gnu.org
  2023-04-12 13:13 ` law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-12 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-04-12
                 CC|                            |law at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

t.ii:2:9: warning: width of 'a::b' exceeds its type
    2 |   short b : -1ULL;
      |         ^

Program received signal SIGSEGV, Segmentation fault.
0x00000000011d5bf4 in initialize_argument_information (num_actuals=1,
args=0x3398c30, args_size=0x7fffffffc750, n_named_args=1, exp=<call_expr
0x7ffff71c3930>, struct_value_addr_value=<tree 0x0>, fndecl=<function_decl
0x7ffff7329200 c>, fntype=<function_type 0x7ffff7205e70>, args_so_far=...,
reg_parm_stack_space=64, old_stack_level=0x7fffffffc6e0,
old_pending_adj=0x7fffffffc6d8, must_preallocate=0x7fffffffc708,
ecf_flags=0x7fffffffc700, may_tailcall=0x7fffffffc78f, call_from_thunk_p=false)
at /space/rguenther/src/gcc/gcc/calls.cc:1519
1519              && XEXP (XVECEXP (args[i].reg, 0, 0), 0) == 0)
Missing separate debuginfos, use: zypper install
libgmp10-debuginfo-6.1.2-4.9.1.x86_64 libmpc3-debuginfo-1.1.0-1.47.x86_64
libmpfr6-debuginfo-4.0.2-3.3.1.x86_64
libzstd1-debuginfo-1.5.0-150400.3.3.1.x86_64
(gdb) bt
#0  0x00000000011d5bf4 in initialize_argument_information (num_actuals=1, 
    args=0x3398c30, args_size=0x7fffffffc750, n_named_args=1, 
    exp=<call_expr 0x7ffff71c3930>, struct_value_addr_value=<tree 0x0>, 
    fndecl=<function_decl 0x7ffff7329200 c>, 
    fntype=<function_type 0x7ffff7205e70>, args_so_far=..., 
    reg_parm_stack_space=64, old_stack_level=0x7fffffffc6e0, 
    old_pending_adj=0x7fffffffc6d8, must_preallocate=0x7fffffffc708, 
    ecf_flags=0x7fffffffc700, may_tailcall=0x7fffffffc78f, 
    call_from_thunk_p=false) at /space/rguenther/src/gcc/gcc/calls.cc:1519
#1  0x00000000011da16d in expand_call (exp=<call_expr 0x7ffff71c3930>, 
    target=0x0, ignore=1) at /space/rguenther/src/gcc/gcc/calls.cc:2973
#2  0x00000000013af7cf in expand_expr_real_1 (exp=<call_expr 0x7ffff71c3930>, 
    target=0x0, tmode=E_VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0, 
    inner_reference_p=false) at /space/rguenther/src/gcc/gcc/expr.cc:11868
#3  0x00000000013a171e in expand_expr_real (exp=<call_expr 0x7ffff71c3930>, 
    target=0x7ffff71cb490, tmode=E_VOIDmode, modifier=EXPAND_NORMAL, 
    alt_rtl=0x0, inner_reference_p=false)
    at /space/rguenther/src/gcc/gcc/expr.cc:9000
#4  0x00000000011cc17f in expand_expr (exp=<call_expr 0x7ffff71c3930>, 
    target=0x7ffff71cb490, mode=E_VOIDmode, modifier=EXPAND_NORMAL)
    at /space/rguenther/src/gcc/gcc/expr.h:310
#5  0x00000000011f3928 in expand_call_stmt (stmt=0x7ffff73371b0)
    at /space/rguenther/src/gcc/gcc/cfgexpand.cc:2831
(gdb) p debug_gimple_stmt (stmt)
# .MEM_3 = VDEF <.MEM_2>
c (D.2324);
(gdb) p debug_tree (exp)
 <call_expr 0x7ffff71c3930
...
    arg:0 <var_decl 0x7ffff7337120 D.2324
        type <record_type 0x7ffff731bd20 a cxx-odr-p type_5 BLK
            size <integer_cst 0x7ffff7338030 constant public overflow 0>
            unit-size <integer_cst 0x7ffff732efa8 constant 2305843009213693952>
            align:64 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
0x7ffff731bd20 fields <function_decl 0x7ffff7329c00 __dt > context
<translation_unit_decl 0x7ffff71d7000 t.ii>
            full-name "struct a"
            X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
            pointer_to_this <pointer_type 0x7ffff731b7e0> reference_to_this
<reference_type 0x7ffff731b690> chain <type_decl 0x7ffff7314688 a>>
        used ignored BLK t.ii:4:16 size <integer_cst 0x7ffff7338030 overflow 0>
unit-size <integer_cst 0x7ffff732efa8 2305843009213693952>
        align:64 warn_if_not_align:0 context <function_decl 0x7ffff7329200 c>
        (mem/c:BLK (reg/f:DI 63 virtual-stack-vars) [1 D.2324+0
S2305843009213693952 A64])>

and the RTL for the argument is

(parallel:BLK [])

ick.  pa_function_arg runs into

9786      arg_size = pa_function_arg_size (mode, type);
9800          if (arg_size > 1)
(gdb) p arg_size
$7 = 0

so isn't able to decipher things down to a "valid" argument spec.  Note
above for the argument type we have TYPE_SIZE == 0 but a very
large TYPE_SIZE_UNIT.

One "obvious" mistake is to use 'int arg_size' for the HOST_WIDE_INT
pa_function_arg_size return value.  Adjusting also downstream variable
types helps to some extent but then we ICE in

during RTL pass: dwarf2
t.ii: In function 'void c(...)':
t.ii:4:23: internal compiler error: in dwarf2out_frame_debug_expr, at
dwarf2cfi.cc:1960
    4 | void c(...) { c(a()); }
      |                       ^
0x12bd9d2 dwarf2out_frame_debug_expr
        /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:1960
0x12bea15 dwarf2out_frame_debug
        /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:2367
0x12bf81b scan_insn_after
        /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:2726
0x12bfe3c scan_trace

seeing

(set (reg:DI 1 %r1)
    (plus:DI (reg/f:DI 30 %r30)
        (const_int 4611686018427379840 [0x3fffffffffffe080])))

which probably means PA would need some alternate form when the
offset gets large.  The following is what's required to get around
the first ICE:

diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index 3f91ebce603..66371f7ced9 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -9775,7 +9775,7 @@ pa_function_arg (cumulative_args_t cum_v, const
function_arg_info &arg)
   machine_mode mode = arg.mode;
   int max_arg_words = (TARGET_64BIT ? 8 : 4);
   int alignment = 0;
-  int arg_size;
+  HOST_WIDE_INT arg_size;
   int fpr_reg_base;
   int gpr_reg_base;
   rtx retval;
@@ -9840,7 +9840,8 @@ pa_function_arg (cumulative_args_t cum_v, const
function_arg_info &arg)
             justified data on a big-endian target.  */

          rtx loc[8];
-         int i, offset = 0, ub = arg_size;
+         int i;
+         HOST_WIDE_INT offset = 0, ub = arg_size;

          /* Align the base register.  */
          gpr_reg_base -= alignment;

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

* [Bug middle-end/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
  2023-04-12 11:31 ` [Bug middle-end/109478] " rguenth at gcc dot gnu.org
@ 2023-04-12 13:13 ` law at gcc dot gnu.org
  2023-04-13 17:11 ` dave.anglin at bell dot net
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2023-04-12 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
The pa.cc bits look reasonable.  It's been forever since I looked at this code,
but clearly using a HOST_WIDE_INT is the right thing to be doing.  While it may
not fix this bug completely, consider it pre-approved.

My PA-fu isn't what it used to be, but I strongly suspect we can't add that
constant directly.  It'd need to be broken down into a multi-instruction
sequence.  Not sure if ldil+ldo is sufficient there or not.

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

* [Bug middle-end/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
  2023-04-12 11:31 ` [Bug middle-end/109478] " rguenth at gcc dot gnu.org
  2023-04-12 13:13 ` law at gcc dot gnu.org
@ 2023-04-13 17:11 ` dave.anglin at bell dot net
  2023-04-15 17:15 ` [Bug target/109478] " danglin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dave.anglin at bell dot net @ 2023-04-13 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from dave.anglin at bell dot net ---
On 2023-04-12 7:31 a.m., rguenth at gcc dot gnu.org wrote:
> and the RTL for the argument is
>
> (parallel:BLK [])
>
> ick.  pa_function_arg runs into
>
> 9786      arg_size = pa_function_arg_size (mode, type);
> 9800          if (arg_size > 1)
> (gdb) p arg_size
> $7 = 0
>
> so isn't able to decipher things down to a "valid" argument spec.  Note
> above for the argument type we have TYPE_SIZE == 0 but a very
> large TYPE_SIZE_UNIT.
>
> One "obvious" mistake is to use 'int arg_size' for the HOST_WIDE_INT
> pa_function_arg_size return value.  Adjusting also downstream variable
> types helps to some extent but then we ICE in
Yes, this is wrong.  However, pa_function_arg only handles the distribution of
arguments to registers.
It's should return NULL_RTX for "large" arg_size values.  Don't know why this
didn't show up before.
>
> during RTL pass: dwarf2
> t.ii: In function 'void c(...)':
> t.ii:4:23: internal compiler error: in dwarf2out_frame_debug_expr, at
> dwarf2cfi.cc:1960
>      4 | void c(...) { c(a()); }
>        |                       ^
> 0x12bd9d2 dwarf2out_frame_debug_expr
>          /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:1960
> 0x12bea15 dwarf2out_frame_debug
>          /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:2367
> 0x12bf81b scan_insn_after
>          /space/rguenther/src/gcc/gcc/dwarf2cfi.cc:2726
> 0x12bfe3c scan_trace
>
> seeing
>
> (set (reg:DI 1 %r1)
>      (plus:DI (reg/f:DI 30 %r30)
>          (const_int 4611686018427379840 [0x3fffffffffffe080])))
Need to investigate where this stack adjustment comes from.

Even if we force the const_int to memory, this will never work with real
hardware.  The maximum physical
address size is 44 bits.

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

* [Bug target/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-04-13 17:11 ` dave.anglin at bell dot net
@ 2023-04-15 17:15 ` danglin at gcc dot gnu.org
  2023-04-16  3:18 ` sjames at gcc dot gnu.org
  2023-04-21 14:39 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: danglin at gcc dot gnu.org @ 2023-04-15 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from John David Anglin <danglin at gcc dot gnu.org> ---
Fixed by commit 4f1c5e54d782b26304b0095ffb3ceb4c92c3c78d.

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

* [Bug target/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-04-15 17:15 ` [Bug target/109478] " danglin at gcc dot gnu.org
@ 2023-04-16  3:18 ` sjames at gcc dot gnu.org
  2023-04-21 14:39 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-16  3:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to John David Anglin from comment #4)
> Fixed by commit 4f1c5e54d782b26304b0095ffb3ceb4c92c3c78d.

i.e. r13-7194-g4f1c5e54d782b26304b0095ffb3ceb4c92c3c78d for the nice link

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

* [Bug target/109478] FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error: Segmentation fault)
  2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-04-16  3:18 ` sjames at gcc dot gnu.org
@ 2023-04-21 14:39 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-21 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by John David Anglin
<danglin@gcc.gnu.org>:

https://gcc.gnu.org/g:dca9419cc3844d3cf3c06f51d5ca57e3b5f50920

commit r12-9461-gdca9419cc3844d3cf3c06f51d5ca57e3b5f50920
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Fri Apr 21 14:38:42 2023 +0000

    Fix handling of large arguments passed by value.

    2023-04-15  John David Anglin  <danglin@gcc.gnu.org>

    gcc/ChangeLog:

            PR target/109478
            * config/pa/pa-protos.h (pa_function_arg_size): Update prototype.
            * config/pa/pa.cc (pa_function_arg): Return NULL_RTX if argument
            size is zero.
            (pa_arg_partial_bytes): Don't call pa_function_arg_size twice.
            (pa_function_arg_size): Change return type to int.  Return zero
            for arguments larger than 1 GB.  Update comments.

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

end of thread, other threads:[~2023-04-21 14:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 21:52 [Bug rtl-optimization/109478] New: FAIL: g++.dg/other/pr104989.C -std=gnu++14 (internal compiler error: Segmentation fault) danglin at gcc dot gnu.org
2023-04-12 11:31 ` [Bug middle-end/109478] " rguenth at gcc dot gnu.org
2023-04-12 13:13 ` law at gcc dot gnu.org
2023-04-13 17:11 ` dave.anglin at bell dot net
2023-04-15 17:15 ` [Bug target/109478] " danglin at gcc dot gnu.org
2023-04-16  3:18 ` sjames at gcc dot gnu.org
2023-04-21 14:39 ` cvs-commit 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).