public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs
@ 2022-03-22 18:22 seurer at gcc dot gnu.org
  2022-03-22 18:58 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: seurer at gcc dot gnu.org @ 2022-03-22 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105023
           Summary: new test case g++.dg/other/pr104989.C ICEs
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:6adbb51eaa85f5bfed1ee06327daca306d48986d, r12-7749-g6adbb51eaa85f5
make  -k check-gcc RUNTESTFLAGS="dg.exp=g++.dg/other/pr104989.C"
FAIL: g++.dg/other/pr104989.C  -std=gnu++98 (internal compiler error:
Segmentation fault signal terminated program cc1plus)
FAIL: g++.dg/other/pr104989.C  -std=gnu++14 (internal compiler error:
Segmentation fault signal terminated program cc1plus)
FAIL: g++.dg/other/pr104989.C  -std=gnu++17 (internal compiler error:
Segmentation fault signal terminated program cc1plus)
FAIL: g++.dg/other/pr104989.C  -std=gnu++20 (internal compiler error: Aborted
signal terminated program cc1plus)
FAIL: g++.dg/other/pr104989.C  -std=gnu++20  1 blank line(s) in output

spawn -ignore SIGHUP
/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/g++/../../xg++
-B/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/g++/../../
/home/seurer/gcc/git/gcc-test/gcc/testsuite/g++.dg/other/pr104989.C
-fdiagnostics-plain-output -nostdinc++
-I/home/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/powerpc64le-unknown-linux-gnu
-I/home/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include
-I/home/seurer/gcc/git/gcc-test/libstdc++-v3/libsupc++
-I/home/seurer/gcc/git/gcc-test/libstdc++-v3/include/backward
-I/home/seurer/gcc/git/gcc-test/libstdc++-v3/testsuite/util -fmessage-length=0
-std=gnu++20 -fnon-call-exceptions -S -o pr104989.s
/home/seurer/gcc/git/gcc-test/gcc/testsuite/g++.dg/other/pr104989.C:6:9:
warning: width of 'a::b' exceeds its type
during RTL pass: expand
*** Error in
`/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/g++/../../cc1plus': free():
corrupted unsorted chunks: 0x0000000012f22e30 ***
/home/seurer/gcc/git/gcc-test/gcc/testsuite/g++.dg/other/pr104989.C: In
function 'void c(...)':

*** Error in
`/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/g++/../../cc1plus': double
free or corruption (!prev): 0x0000000012f22e30 ***
xg++: internal compiler error: Aborted signal terminated program cc1plus



commit 6adbb51eaa85f5bfed1ee06327daca306d48986d (HEAD, refs/bisect/bad)
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 22 08:39:40 2022 +0100

    calls: Fix error recovery after sorry differently [PR104989]

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
@ 2022-03-22 18:58 ` jakub at gcc dot gnu.org
  2022-03-22 22:33 ` segher at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-22 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is already
FAIL: g++.dg/other/pr84964.C  -std=c++98 (internal compiler error: Aborted
signal terminated program cc1plus)
FAIL: g++.dg/other/pr84964.C  -std=c++98  1 blank line(s) in output
FAIL: g++.dg/other/pr84964.C  -std=c++14 (internal compiler error: Aborted
signal terminated program cc1plus)
FAIL: g++.dg/other/pr84964.C  -std=c++14  1 blank line(s) in output
FAIL: g++.dg/other/pr84964.C  -std=c++17 (internal compiler error: Aborted
signal terminated program cc1plus)
FAIL: g++.dg/other/pr84964.C  -std=c++17  1 blank line(s) in output
FAIL: g++.dg/other/pr84964.C  -std=c++20 (internal compiler error: Aborted
signal terminated program cc1plus)
FAIL: g++.dg/other/pr84964.C  -std=c++20  1 blank line(s) in output
and this is just a dup of it, we ICE before the sorry is called.

The reason it works on x86 etc. is that in that case if (args[i].reg == 0 ||
args[i].pass_on_stack) is true, while on ppc64le it is false - it wants to pass
that huge argument partially in (reg:BLK 3 3) (isn't that a bug?  BLKmode REGs
are just weird) and partially on the stack.
Either this should be fixed in the backend, or the generic code should just
sorry no matter if huge arguments are passed partially in registers or not.

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
  2022-03-22 18:58 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
@ 2022-03-22 22:33 ` segher at gcc dot gnu.org
  2022-03-23  7:47 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: segher at gcc dot gnu.org @ 2022-03-22 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
@findex BLKmode
@item BLKmode
``Block'' mode represents values that are aggregates to which none of
the other modes apply.  In RTL, only memory references can have this mode,
and only if they appear in string-move or vector instructions.  On machines
which have no such instructions, @code{BLKmode} will not appear in RTL@.

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
  2022-03-22 18:58 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
  2022-03-22 22:33 ` segher at gcc dot gnu.org
@ 2022-03-23  7:47 ` jakub at gcc dot gnu.org
  2022-03-23 15:45 ` [Bug target/105023] " segher at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-23  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
But reg:BLK is exactly what the backend emits.
Both on the 2 testcases mentioned above (on which there is an ICE afterwards)
and say on:
struct a {
  short b : 2048;
};
void c(...) { c(a()); }
which doesn't ICE.  rs6000_function_arg still returns (reg:BLK 3 3).

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

* [Bug target/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-03-23  7:47 ` jakub at gcc dot gnu.org
@ 2022-03-23 15:45 ` segher at gcc dot gnu.org
  2022-03-23 16:01 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: segher at gcc dot gnu.org @ 2022-03-23 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
It never even executes rs6000_function_arg for that testcase.  What are you
doing differently?  ...  Oh, C++.  Duh.

It happens because we do
  return gen_rtx_REG (mode, gregno);
which is perfectly valid: garbage in, garbage out.  This is arg.mode, a
function parameter here.  Make the caller do some validation?  BLKmode is not
a valid mode to pass to function_arg.

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-03-23 15:45 ` [Bug target/105023] " segher at gcc dot gnu.org
@ 2022-03-23 16:01 ` jakub at gcc dot gnu.org
  2022-03-23 17:37 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-23 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BLKmode is valid mode for larger aggregate arguments and return values.
As documented:
"The return value is usually either a @code{reg} RTX for the hard
register in which to pass the argument, or zero to pass the argument
on the stack.

The value of the expression can also be a @code{parallel} RTX@.  This is
used when an argument is passed in multiple locations.  The mode of the
@code{parallel} should be the mode of the entire argument.  The
@code{parallel} holds any number of @code{expr_list} pairs; each one
describes where part of the argument is passed.  In each
@code{expr_list} the first operand must be a @code{reg} RTX for the hard
register in which to pass this part of the argument, and the mode of the
register RTX indicates how large this part of the argument is.  The
second operand of the @code{expr_list} is a @code{const_int} which gives
the offset in bytes into the entire argument of where this part starts.
As a special exception the first @code{expr_list} in the @code{parallel}
RTX may have a first operand of zero.  This indicates that the entire
argument is also stored on the stack.

The last time this hook is called, it is called with @code{MODE ==
VOIDmode}, and its result is passed to the @code{call} or @code{call_value}
pattern as operands 2 and 3 respectively."

If the whole argument is to be passed on the stack, the hook should just return
NULL_RTX.  In case the psABI says for such structures (say the one with short :
 2048 bitfield) should be partially passed in registers, still (reg:BLK 3 3)
seems to be a wrong answer, it could use (parallel:BLK [(reg:DI 3 3) (reg:DI 4
4) (reg:DI 5 5) (reg:DI 6 6)]) to indicate passing say first 256 bits in
registers and the rest on the stack.

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-03-23 16:01 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
@ 2022-03-23 17:37 ` segher at gcc dot gnu.org
  2022-04-07  8:56 ` guojiufu at gcc dot gnu.org
  2022-04-08  3:32 ` guojiufu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: segher at gcc dot gnu.org @ 2022-03-23 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
BLKmode is *not* valid for registers.  reg:BLK at one time was a special
marker for invalid asm operands, apparently.

:BLK is for mem, and for parallel as well in some cases, but not for reg.

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-03-23 17:37 ` segher at gcc dot gnu.org
@ 2022-04-07  8:56 ` guojiufu at gcc dot gnu.org
  2022-04-08  3:32 ` guojiufu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2022-04-07  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |guojiufu at gcc dot gnu.org

--- Comment #7 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
This would already been fixed via r12-7833
(41d1f11f5f693a2a06c65c9467a28dfeb02aed85).

With this patch, the call is:
(call_insn/u/c 23 22 0 (parallel [
            (call (mem:SI (symbol_ref:DI ("_Z1cz") [flags 0x3]  <function_decl
0x200000d95100 c>) [0 c S4 A8])
                (const_int 2305843009213693952 [0x2000000000000000]))
            (use (const_int 0 [0]))
            (clobber (reg:DI 96 lr))
        ]) "/home/guojiufu/temp/pr104989.C":8:16 -1
     (expr_list:REG_CALL_DECL (symbol_ref:DI ("_Z1cz") [flags 0x3] 
<function_decl 0x200000d95100 c>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list (use (reg:DI 2 %r2))
        (expr_list (use (reg:DI 10 %r10))
            (expr_list (use (reg:DI 9 %r9))
                (expr_list (use (reg:DI 8 %r8))
                    (expr_list (use (reg:DI 7 %r7))
                        (expr_list (use (reg:DI 6 %r6))
                            (expr_list (use (reg:DI 5 %r5))
                                (expr_list (use (reg:DI 4 %r4))
                                    (expr_list (use (reg:DI 3 %r3))
                                        (expr_list:BLK (use (mem:BLK (reg/f:DI
114 virtual-outgoing-args) [0  S2305843009213693952 A128]))
                                            (nil))))))))))))

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

* [Bug rtl-optimization/105023] new test case g++.dg/other/pr104989.C ICEs
  2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-04-07  8:56 ` guojiufu at gcc dot gnu.org
@ 2022-04-08  3:32 ` guojiufu at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2022-04-08  3:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:

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

--- Comment #8 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
mark as fixed.

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

end of thread, other threads:[~2022-04-08  3:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 18:22 [Bug rtl-optimization/105023] New: new test case g++.dg/other/pr104989.C ICEs seurer at gcc dot gnu.org
2022-03-22 18:58 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
2022-03-22 22:33 ` segher at gcc dot gnu.org
2022-03-23  7:47 ` jakub at gcc dot gnu.org
2022-03-23 15:45 ` [Bug target/105023] " segher at gcc dot gnu.org
2022-03-23 16:01 ` [Bug rtl-optimization/105023] " jakub at gcc dot gnu.org
2022-03-23 17:37 ` segher at gcc dot gnu.org
2022-04-07  8:56 ` guojiufu at gcc dot gnu.org
2022-04-08  3:32 ` guojiufu 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).