public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105485] New: ICE: Segmentation fault in pcrel-opt.md:get_insn_name()
@ 2022-05-04 20:02 pthaugen at gcc dot gnu.org
  2022-05-06  7:17 ` [Bug target/105485] " linkw at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2022-05-04 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105485
           Summary: ICE: Segmentation fault in
                    pcrel-opt.md:get_insn_name()
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pthaugen at gcc dot gnu.org
  Target Milestone: ---
              Host: powerpc64le-linux-gnu
            Target: powerpc64le-linux-gnu
             Build: powerpc64le-linux-gnu

pthaugen@pike:~/temp$ cat err.c
template <class> void __builtin_vec_vslv();
typedef  __attribute__((altivec(vector__))) char T;
void b() {
  T c, d;
  __builtin_vec_vslv(c, d);
}


pthaugen@pike:~/temp$ ~/install/gcc/trunk/bin/g++ -mcpu=power9 -S -O2 err.c
during GIMPLE pass: lower
err.c: In function ‘void b()’:
err.c:3:6: internal compiler error: Segmentation fault
    3 | void b() {
      |      ^
0x10fca4e3 crash_signal
        /home/pthaugen/src/gcc/trunk/gcc/gcc/toplev.cc:322
0x11cd9a10 get_insn_name(int)
        /home/pthaugen/src/gcc/trunk/gcc/gcc/config/rs6000/pcrel-opt.md:134798
0x11635f87 rs6000_gimple_fold_builtin(gimple_stmt_iterator*)
       
/home/pthaugen/src/gcc/trunk/gcc/gcc/config/rs6000/rs6000-builtin.cc:1301
0x10b3c017 gimple_fold_call
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-fold.cc:5559
0x10b3e00b fold_stmt_1
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-fold.cc:6298
0x11e5ce17 lower_stmt
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-low.cc:390
0x11e5ce17 lower_sequence
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-low.cc:217
0x11e5bf03 lower_gimple_bind
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-low.cc:475
0x11e5dc33 lower_function_body
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-low.cc:110
0x11e5dc33 execute
        /home/pthaugen/src/gcc/trunk/gcc/gcc/gimple-low.cc:195
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.


pthaugen@pike:~/temp$ ~/install/gcc/trunk/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/pthaugen/install/gcc/trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/pthaugen/install/gcc/trunk/libexec/gcc/powerpc64le-unknown-linux-gnu/13.0.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: /home/pthaugen/src/gcc/trunk/gcc/configure
--prefix=/home/pthaugen/install/gcc/trunk --enable-decimal-float --enable-lto
--with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,fortran,c++
--disable-multilib --disable-libsanitizer --with-cpu=power8 --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220504 (experimental) [master r13-118-g4a206161072] (GCC)

^ 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 ` 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

end of thread, other threads:[~2022-09-21  5:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).