* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
@ 2022-05-06 7:17 ` linkw at gcc dot gnu.org
2022-05-10 12:23 ` linkw at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-06 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |linkw at gcc dot gnu.org
Last reconfirmed| |2022-05-06
Status|UNCONFIRMED |NEW
CC| |linkw at gcc dot gnu.org
--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed.
AT15.0 (GCC11) emits error messages instead of ICE.
err.c: In function ‘T b()’:
err.c:7:29: error: unresolved overload for Altivec builtin ‘__vector(4) int
__builtin_vec_vslv(__vector(4) int, __vector(4) int)’
7 | return __builtin_vec_vslv (c, d);
| ~~~~~~~~~~~~~~~~~~~^~~~~~
I thought it's due to new bif framework, but met the same ICE with one gcc
right before new bif framework is enabled.
The target hook gimple_fold_builtin expects normal BIF code instead of OVLD
code, but for this case DECL_MD_FUNCTION_CODE returns OVLD code which is out of
expectation.
Doing a bisection.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
2022-05-06 7:17 ` [Bug target/105485] " linkw at gcc dot gnu.org
@ 2022-05-10 12:23 ` linkw at gcc dot gnu.org
2022-05-10 12:26 ` linkw at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-10 12:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
I was wrong, the local branch which I used as old bif support isn't the one
before new bif support. The bisection showed it's a regression and started from
r12-5752 (new bif support).
By looking to the old bif support, I noticed that it's expected that this
function won't be resolved, but we need to emit one error message during
expanding. With old bif support, __builtin_vec_vslv is binded to the normal
(primary) bif enum (bif code), it needs overloaded resolver (target hook) to
resolve it into the overloaded bif enum; while with new bif support,
__builtin_vec_vslv is binded to the overload bif enum, it needs overloaded
resolver to resolve it into the one defined in rs6000-builtins.def (one
instance of overloaded).
In new bif support, rs6000_gimple_fold_builtin won't be able to handle the
unresolved overloaded bif. Note that it doesn't in old bif support, but both
primary and overloaded code shares the same table, so it's fine and no ICEs.
With new bif support, overloaded bif code has its own table.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
2022-05-06 7:17 ` [Bug target/105485] " linkw at gcc dot gnu.org
2022-05-10 12:23 ` linkw at gcc dot gnu.org
@ 2022-05-10 12:26 ` linkw at gcc dot gnu.org
2022-05-10 12:27 ` linkw at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-10 12:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
This issue can happen for any bif which supports overloading.
for example, same ICE for:
typedef __attribute__ ((altivec (vector__))) signed int T;
template <class> void __builtin_vec_splats ();
T b (T i)
{
return __builtin_vec_splats (i);
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
` (2 preceding siblings ...)
2022-05-10 12:26 ` linkw at gcc dot gnu.org
@ 2022-05-10 12:27 ` linkw at gcc dot gnu.org
2022-09-13 10:40 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-10 12:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
Created attachment 52949
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52949&action=edit
untested patch
This attached patch can get it fixed. Will test it further and add one test
case.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
` (3 preceding siblings ...)
2022-05-10 12:27 ` linkw at gcc dot gnu.org
@ 2022-09-13 10:40 ` cvs-commit at gcc dot gnu.org
2022-09-21 5:07 ` cvs-commit at gcc dot gnu.org
2022-09-21 5:09 ` linkw at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-13 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:
https://gcc.gnu.org/g:94504c9ae157db937a2e62d533a36d56598f3c09
commit r13-2642-g94504c9ae157db937a2e62d533a36d56598f3c09
Author: Kewen.Lin <linkw@gcc.gnu.org>
Date: Tue Sep 13 04:13:59 2022 -0500
rs6000: Handle unresolved overloaded builtin [PR105485]
PR105485 exposes that new builtin function framework doesn't handle
unresolved overloaded builtin function well. With new builtin
function support, we don't have builtin info for any overloaded
rs6000_gen_builtins enum, since they are expected to be resolved to
one specific instance. So when function rs6000_gimple_fold_builtin
faces one unresolved overloaded builtin, the access for builtin info
becomes out of bound and gets ICE then.
We should not try to fold one unresolved overloaded builtin there
and as the previous support we should emit one error message during
expansion phase like "unresolved overload for builtin ...".
PR target/105485
gcc/ChangeLog:
* config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_builtin): Add
the handling for unresolved overloaded builtin function.
(rs6000_expand_builtin): Likewise.
gcc/testsuite/ChangeLog:
* g++.target/powerpc/pr105485.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
` (4 preceding siblings ...)
2022-09-13 10:40 ` cvs-commit at gcc dot gnu.org
@ 2022-09-21 5:07 ` cvs-commit at gcc dot gnu.org
2022-09-21 5:09 ` linkw at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-21 5:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:
https://gcc.gnu.org/g:104864f99c07f87b53c7f45c50a1991b21249489
commit r12-8777-g104864f99c07f87b53c7f45c50a1991b21249489
Author: Kewen.Lin <linkw@gcc.gnu.org>
Date: Tue Sep 13 04:13:59 2022 -0500
rs6000: Handle unresolved overloaded builtin [PR105485]
PR105485 exposes that new builtin function framework doesn't handle
unresolved overloaded builtin function well. With new builtin
function support, we don't have builtin info for any overloaded
rs6000_gen_builtins enum, since they are expected to be resolved to
one specific instance. So when function rs6000_gimple_fold_builtin
faces one unresolved overloaded builtin, the access for builtin info
becomes out of bound and gets ICE then.
We should not try to fold one unresolved overloaded builtin there
and as the previous support we should emit one error message during
expansion phase like "unresolved overload for builtin ...".
PR target/105485
gcc/ChangeLog:
* config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_builtin): Add
the handling for unresolved overloaded builtin function.
(rs6000_expand_builtin): Likewise.
gcc/testsuite/ChangeLog:
* g++.target/powerpc/pr105485.C: New test.
(cherry picked from commit 94504c9ae157db937a2e62d533a36d56598f3c09)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/105485] ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
2022-05-04 20:02 [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name() pthaugen at gcc dot gnu.org
` (5 preceding siblings ...)
2022-09-21 5:07 ` cvs-commit at gcc dot gnu.org
@ 2022-09-21 5:09 ` linkw at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-09-21 5:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105485
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Kewen Lin <linkw at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread