public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int
@ 2023-09-03 22:37 vincent.riviere at freesbee dot fr
2023-09-03 22:43 ` [Bug target/111279] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: vincent.riviere at freesbee dot fr @ 2023-09-03 22:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
Bug ID: 111279
Summary: ICE: Segmentation fault with m68k,SJLJ and -malign-int
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vincent.riviere at freesbee dot fr
Target Milestone: ---
m68k-elf-g++ causes "internal compiler error: Segmentation fault" when
configured for m68k-elf, SJLJ exceptions, and compiling a specific program with
-malign-int.
$ cat >bug.cc <<EOF
template<typename T>
struct A
{
A()
{ }
char buf[4];
};
template<typename T>
struct B : public A<T>
{
B()
{ }
};
template<typename T>
struct C : public B<T>
{
C() throw()
{ }
};
void f()
{
C<char> tmp;
}
EOF
gcc was configured with:
~/sources/gcc/configure --target=m68k-elf --disable-nls --disable-multilib
--enable-languages="c,c++" --disable-libstdc++-pch --disable-lto
--enable-sjlj-exceptions
$ /home/vincent/compil/gccelfsjlj.obj/gcc/cc1plus bug.cc -malign-int
A<T>::A() B<T>::B() C<T>::C() void f() C<char> B<char> A<char> C<T>::C() [with
T = char] C<T>::C() [with T = char] C<T>::C() [with T = char] B<T>::B() [with T
= char] B<T>::B() [with T = char] B<T>::B() [with T = char] A<T>::A() [with T =
char] A<T>::A() [with T = char] A<T>::A() [with T = char]
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> {heap 1068k} <visibility> {heap 1068k} <build_ssa_passes>
{heap 1068k} <opt_local_passes> {heap 1348k} <remove_symbols> {heap 1348k}
<targetclone> {heap 1348k} <free-fnsummary> {heap 1348k}Streaming LTO
<whole-program> {heap 1348k} <fnsummary> {heap 1348k} <inline> {heap 1348k}
<modref> {heap 1348k} <free-fnsummary> {heap 1348k} <single-use> {heap 1348k}
<comdats> {heap 1348k}Assembling functions:
void f() C<T>::C() [with T = char]during RTL pass: expand
bug.cc: In constructor 'C<T>::C() [with T = char]':
bug.cc:21:5: internal compiler error: Segmentation fault
21 | { }
| ^
0x1174ec3 crash_signal
/home/vincent/sources/gcc/gcc/toplev.cc:314
0x7f7ca4a3c4af ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xe08653 assign_temp(tree_node*, int, int)
/home/vincent/sources/gcc/gcc/function.cc:976
0xdab01f emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned
int, int, rtx_def*, poly_int<1u, long>, rtx_def*, rtx_def*, int, rtx_def*,
bool)
/home/vincent/sources/gcc/gcc/expr.cc:4920
0xc5f915 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type,
machine_mode, int, std::pair<rtx_def*, machine_mode>*)
/home/vincent/sources/gcc/gcc/calls.cc:4585
0xd765bf emit_library_call(rtx_def*, libcall_type, machine_mode, rtx_def*,
machine_mode)
/home/vincent/sources/gcc/gcc/rtl.h:4343
0xd765bf sjlj_emit_function_enter
/home/vincent/sources/gcc/gcc/except.cc:1212
0xd7b90d sjlj_build_landing_pads
/home/vincent/sources/gcc/gcc/except.cc:1491
0xd7b90d finish_eh_generation()
/home/vincent/sources/gcc/gcc/except.cc:1520
0xc7c1a6 execute
/home/vincent/sources/gcc/gcc/cfgexpand.cc:6940
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.
$ /home/vincent/compil/gccelfsjlj.obj/gcc/cc1plus bug.cc -malign-int
A<T>::A() B<T>::B() C<T>::C() void f() C<char> B<char> A<char> C<T>::C() [with
T = char] C<T>::C() [with T = char] C<T>::C() [with T = char] B<T>::B() [with T
= char] B<T>::B() [with T = char] B<T>::B() [with T = char] A<T>::A() [with T =
char] A<T>::A() [with T = char] A<T>::A() [with T = char]
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> {heap 1068k} <visibility> {heap 1068k} <build_ssa_passes>
{heap 1068k} <opt_local_passes> {heap 1348k} <remove_symbols> {heap 1348k}
<targetclone> {heap 1348k} <free-fnsummary> {heap 1348k}Streaming LTO
<whole-program> {heap 1348k} <fnsummary> {heap 1348k} <inline> {heap 1348k}
<modref> {heap 1348k} <free-fnsummary> {heap 1348k} <single-use> {heap 1348k}
<comdats> {heap 1348k}Assembling functions:
void f() C<T>::C() [with T = char]during RTL pass: expand
bug.cc: In constructor 'C<T>::C() [with T = char]':
bug.cc:21:5: internal compiler error: Segmentation fault
21 | { }
| ^
0x1174ec3 crash_signal
/home/vincent/sources/gcc/gcc/toplev.cc:314
0x7f7ca4a3c4af ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xe08653 assign_temp(tree_node*, int, int)
/home/vincent/sources/gcc/gcc/function.cc:976
0xdab01f emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned
int, int, rtx_def*, poly_int<1u, long>, rtx_def*, rtx_def*, int, rtx_def*,
bool)
/home/vincent/sources/gcc/gcc/expr.cc:4920
0xc5f915 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type,
machine_mode, int, std::pair<rtx_def*, machine_mode>*)
/home/vincent/sources/gcc/gcc/calls.cc:4585
0xd765bf emit_library_call(rtx_def*, libcall_type, machine_mode, rtx_def*,
machine_mode)
/home/vincent/sources/gcc/gcc/rtl.h:4343
0xd765bf sjlj_emit_function_enter
/home/vincent/sources/gcc/gcc/except.cc:1212
0xd7b90d sjlj_build_landing_pads
/home/vincent/sources/gcc/gcc/except.cc:1491
0xd7b90d finish_eh_generation()
/home/vincent/sources/gcc/gcc/except.cc:1520
0xc7c1a6 execute
/home/vincent/sources/gcc/gcc/cfgexpand.cc:6940
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.
Tested with the current master branch (GCC 14), and also with GCC 13.2.0.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
@ 2023-09-03 22:43 ` pinskia at gcc dot gnu.org
2023-09-04 5:06 ` admin@tho-otto.de
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-03 22:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
sjlj-exceptions is very much not tested as much as the others.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
2023-09-03 22:43 ` [Bug target/111279] " pinskia at gcc dot gnu.org
@ 2023-09-04 5:06 ` admin@tho-otto.de
2023-09-04 13:21 ` admin@tho-otto.de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: admin@tho-otto.de @ 2023-09-04 5:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
Thorsten Otto <admin@tho-otto.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |admin@tho-otto.de
--- Comment #2 from Thorsten Otto <admin@tho-otto.de> ---
emit_push_insn is called from
https://gcc.gnu.org/git?p=gcc.git;a=blob;f=gcc/calls.cc;h=1f3a6d5c45099499deeef63f867ed11774dec47e;hb=HEAD#l4585
where only a NULL_TREE pointer is passed for the type, and crashes when trying
to access the TREE_CODE.
The call to assign_temp was inserted by
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=46bd2beed4c78dcb32fcde4913815527c14e5e17
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
2023-09-03 22:43 ` [Bug target/111279] " pinskia at gcc dot gnu.org
2023-09-04 5:06 ` admin@tho-otto.de
@ 2023-09-04 13:21 ` admin@tho-otto.de
2024-01-03 16:06 ` mikpelinux at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: admin@tho-otto.de @ 2023-09-04 13:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
--- Comment #3 from Thorsten Otto <admin@tho-otto.de> ---
Created attachment 55837
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55837&action=edit
Avoid segmentation fault when calling assign_temp with a NULL type pointer
Attached is a potential patch to fix that.
The above mentioned commit was made for gcc 4.3, and all compiler versions
after that are affected by it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
` (2 preceding siblings ...)
2023-09-04 13:21 ` admin@tho-otto.de
@ 2024-01-03 16:06 ` mikpelinux at gmail dot com
2024-01-03 22:29 ` admin@tho-otto.de
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mikpelinux at gmail dot com @ 2024-01-03 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
(In reply to Thorsten Otto from comment #3)
> Created attachment 55837 [details]
> Avoid segmentation fault when calling assign_temp with a NULL type pointer
>
> Attached is a potential patch to fix that.
>
> The above mentioned commit was made for gcc 4.3, and all compiler versions
> after that are affected by it.
This patch also fixes PR82420. That PR contains a tidied up patch with a test
case and proper attribution to your original. Will you submit your patch or
should I submit mine?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
` (3 preceding siblings ...)
2024-01-03 16:06 ` mikpelinux at gmail dot com
@ 2024-01-03 22:29 ` admin@tho-otto.de
2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
2024-01-21 23:01 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: admin@tho-otto.de @ 2024-01-03 22:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
--- Comment #5 from Thorsten Otto <admin@tho-otto.de> ---
I don't mind. If your patch also contains a test case, just use that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
` (4 preceding siblings ...)
2024-01-03 22:29 ` admin@tho-otto.de
@ 2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
2024-01-21 23:01 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-21 22:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:
https://gcc.gnu.org/g:bdcf7226c9fe87352466eb9a6bfc58fa24b3e5e1
commit r14-8324-gbdcf7226c9fe87352466eb9a6bfc58fa24b3e5e1
Author: Mikael Pettersson <mikpelinux@gmail.com>
Date: Sun Jan 21 15:55:49 2024 -0700
Re: [PATCH] Avoid ICE with m68k-elf -malign-int and libcalls
>> emit_library_call_value_1 calls emit_push_insn with NULL_TREE
>> for TYPE. Sometimes emit_push_insn needs to assign a temp with
>> that TYPE, which causes a segfault.
>>
>> Fixed by computing the TYPE from MODE when needed.
>>
>> Original patch by Thorsten Otto.
>>
[ ... ]
> This really needs to happen in the two call paths which pass in
> NULL_TREE for the type. Note how the type is used to determine padding
> earlier in emit_push_insn. That would also make the code more
> consistent with the comment before emit_push_insn which implies that
> both MODE and TYPE are valid.
>
>
> Additionally you should bootstrap and regression test this patch on at
> least one target.
Updated as requested, and bootstrapped and tested on
{x86_64,aarch64,m68k}-linux-gnu without regressions.
gcc/
PR target/82420
PR target/111279
* calls.cc (emit_library_call_value_1): Pass valid TYPE
to emit_push_insn.
* expr.cc (emit_push_insn): Likewise.
gcc/testsuite/
PR target/82420
* gcc.target/m68k/pr82420.c: New test.
Co-authored-by: Thorsten Otto <admin@tho-otto.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/111279] ICE: Segmentation fault with m68k,SJLJ and -malign-int
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
` (5 preceding siblings ...)
2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
@ 2024-01-21 23:01 ` law at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-01-21 23:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111279
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |law at gcc dot gnu.org
Resolution|--- |FIXED
Target Milestone|--- |14.0
--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Should be fixed on the trunk. No plans to backport.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-01-21 23:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 22:37 [Bug c++/111279] New: ICE: Segmentation fault with m68k,SJLJ and -malign-int vincent.riviere at freesbee dot fr
2023-09-03 22:43 ` [Bug target/111279] " pinskia at gcc dot gnu.org
2023-09-04 5:06 ` admin@tho-otto.de
2023-09-04 13:21 ` admin@tho-otto.de
2024-01-03 16:06 ` mikpelinux at gmail dot com
2024-01-03 22:29 ` admin@tho-otto.de
2024-01-21 22:59 ` cvs-commit at gcc dot gnu.org
2024-01-21 23:01 ` law 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).