public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104068] New: ICE Segmentation fault with type alias
@ 2022-01-17 14:23 marc.rivinius.sec at gmail dot com
  2022-01-17 15:01 ` [Bug c++/104068] " marxin at gcc dot gnu.org
  2023-10-20 15:04 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: marc.rivinius.sec at gmail dot com @ 2022-01-17 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104068
           Summary: ICE Segmentation fault with type alias
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marc.rivinius.sec at gmail dot com
  Target Milestone: ---

Created attachment 52212
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52212&action=edit
Preprocessed source

I encountered an ICE (segmentation fault) in gcc version 10.2.1 (exact version
and configuration below).

Note: All version of x86-64 gcc >= 6.1.0 I tested on Compiler Explorer show
this behavior: https://godbolt.org/z/5eYaP87hW

Compiler input/output:
$ gcc -v -save-temps -Wall -Wextra -Wpedantic -Werror -c bug.cpp
Using built-in specs.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-gcn/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-Wpedantic' '-Werror'
'-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE bug.cpp -mtune=generic -march=x86-64 -Wall
-Wextra -Wpedantic -Werror -fpch-preprocess -fasynchronous-unwind-tables -o
bug.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/10"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/10/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/10
 /usr/include/x86_64-linux-gnu/c++/10
 /usr/include/c++/10/backward
 /usr/lib/gcc/x86_64-linux-gnu/10/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-Wpedantic' '-Werror'
'-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -fpreprocessed bug.ii -quiet
-dumpbase bug.cpp -mtune=generic -march=x86-64 -auxbase bug -Wall -Wextra
-Wpedantic -Werror -version -fasynchronous-unwind-tables -o bug.s
GNU C++14 (Debian 10.2.1-6) version 10.2.1 20210110 (x86_64-linux-gnu)
        compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR
version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (Debian 10.2.1-6) version 10.2.1 20210110 (x86_64-linux-gnu)
        compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR
version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 048fcaee3460a99eb0d68522358720e1
bug.cpp: In instantiation of ‘struct view<traits<int> >’:
bug.cpp:41:17:   required from here
bug.cpp:35:48: internal compiler error: Segmentation fault
   35 |     constexpr view_with_extent<Traits, Extent>
subview(constant<size_type, Extent>) const noexcept
      |                                                ^~~~~~~
0x7fdd395c2d5f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7fdd395add09 __libc_start_main
        ../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

---

gcc 11.X gives more details (on Compiler Explorer):
<source>: In instantiation of 'struct view<traits<int> >':
<source>:41:17:   required from here
<source>:35:48: internal compiler error: Segmentation fault
   35 |     constexpr view_with_extent<Traits, Extent>
subview(constant<size_type, Extent>) const noexcept
      |                                                ^~~~~~~
0x1786229 internal_error(char const*, ...)
        ???:0
0x7dd289 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7edc30 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7ef008 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dd864 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7de88b tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dd40d tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7ddad6 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7edc30 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7ef008 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dd7cc tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dd5ae tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7dd8a7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7f9ecb instantiate_class_template(tree_node*)
        ???:0
0x82d1b3 complete_type(tree_node*)
        ???:0
0x7fb17b do_type_instantiation(tree_node*, tree_node*, int)
        ???:0
0x7c47db c_parse_file()
        ???:0
0x896762 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.

---

Different definitions of size_type in view_with_extent avoid the ICE.
using size_type = typename Traits::size_type; // would fix the problem
using size_type = unsigned; // would also fix the problem

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

* [Bug c++/104068] ICE Segmentation fault with type alias
  2022-01-17 14:23 [Bug c++/104068] New: ICE Segmentation fault with type alias marc.rivinius.sec at gmail dot com
@ 2022-01-17 15:01 ` marxin at gcc dot gnu.org
  2023-10-20 15:04 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-17 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-17

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, it's old ICE.

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

* [Bug c++/104068] ICE Segmentation fault with type alias
  2022-01-17 14:23 [Bug c++/104068] New: ICE Segmentation fault with type alias marc.rivinius.sec at gmail dot com
  2022-01-17 15:01 ` [Bug c++/104068] " marxin at gcc dot gnu.org
@ 2023-10-20 15:04 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-20 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Still ICEs:

old.C: In instantiation of ‘struct view<traits<int> >’:
old.C:41:17:   required from here
   41 | template struct view<traits<int>>;
      |                 ^~~~~~~~~~~~~~~~~
old.C:35:48: internal compiler error: tree check: accessed elt 2 of ‘tree_vec’
with 1 elts in tsubst, at cp/pt.cc:16139
   35 |     constexpr view_with_extent<Traits, Extent>
subview(constant<size_type, Extent>) const noexcept
      |                                                ^~~~~~~
0x1e20b6d tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        /home/mpolacek/src/gcc/gcc/tree.cc:9148
0xd4be56 tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
        /home/mpolacek/src/gcc/gcc/tree.h:3849
0x10afc84 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:16139
0x10b7e23 tsubst_copy
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:17867
0x10cfbcc tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:21884
0x10c5cce tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:19927
0x109a63f tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:12627

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

end of thread, other threads:[~2023-10-20 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 14:23 [Bug c++/104068] New: ICE Segmentation fault with type alias marc.rivinius.sec at gmail dot com
2022-01-17 15:01 ` [Bug c++/104068] " marxin at gcc dot gnu.org
2023-10-20 15:04 ` mpolacek 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).