From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D9BD53858D38; Fri, 26 Jan 2024 06:02:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9BD53858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706248976; bh=6bm+IWSFbOqKgQFWiXW5eg4Ma6LPpNCrTRCtbJZmxFQ=; h=From:To:Subject:Date:From; b=gR/muxv5FF7P9fWIWWYg+wUPOVY7GAAtUiEkjEtjaGHHGSMc+3DR6SQQYMn/tXZgI 2DCHwiTpFAWUPCNX80T4GF0lukinPk3LMlRTUGcum5pwvwnSqUE3l1e/ROaeG1E8Ue jomKybocT36WBcmU1gtTuYsXr+JAvmdvnEkCalzQ= From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113612] New: ICE: SIGSEGV in get_template_info (pt.cc:378) or tree_check (tree.h:3611) with invalid -fpreprocessed Date: Fri, 26 Jan 2024 06:02:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gcctarget attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113612 Bug ID: 113612 Summary: ICE: SIGSEGV in get_template_info (pt.cc:378) or tree_check (tree.h:3611) with invalid -fpreprocessed Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 57219 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57219&action=3Dedit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc testcase.C -c $ x86_64-pc-linux-gnu-gcc -fpreprocessed testcase.C -wrapper valgrind,-q testcase.C:1:1: error: stray '#' in program 1 | #if defined0 | ^ testcase.C:6:1: error: stray '#' in program 6 | #endif | ^ testcase.C:1:2: error: expected unqualified-id before 'if' 1 | #if defined0 | ^~ =3D=3D1836=3D=3D Invalid read of size 2 =3D=3D1836=3D=3D at 0x10B82AE: get_template_info(tree_node const*) (pt.c= c:378) =3D=3D1836=3D=3D by 0x10D80F7: get_partial_spec_bindings(tree_node*, tre= e_node*, tree_node*) (pt.cc:25875) =3D=3D1836=3D=3D by 0x10D890D: most_specialized_partial_spec(tree_node*,= int, bool) (pt.cc:26190) =3D=3D1836=3D=3D by 0x10D975F: instantiate_template(tree_node*, tree_nod= e*, int) (pt.cc:22074) =3D=3D1836=3D=3D by 0x113558A: finish_id_expression_1(tree_node*, tree_n= ode*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) (semantics.cc:4392) =3D=3D1836=3D=3D by 0x1135F66: finish_id_expression(tree_node*, tree_nod= e*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) (semantics.cc:4573) =3D=3D1836=3D=3D by 0x107D2DA: cp_parser_primary_expression(cp_parser*, = bool, bool, bool, bool, cp_id_kind*) (parser.cc:6300) =3D=3D1836=3D=3D by 0x108A225: cp_parser_postfix_expression(cp_parser*, = bool, bool, bool, bool, cp_id_kind*) (parser.cc:7924) =3D=3D1836=3D=3D by 0x106805C: cp_parser_binary_expression(cp_parser*, b= ool, bool, bool, cp_parser_prec, cp_id_kind*) (parser.cc:10383) =3D=3D1836=3D=3D by 0x1068D62: cp_parser_assignment_expression(cp_parser= *, cp_id_kind*, bool, bool) (parser.cc:10727) =3D=3D1836=3D=3D by 0x1069E85: cp_parser_constant_expression(cp_parser*,= int, bool*, bool) (parser.cc:11017) =3D=3D1836=3D=3D by 0x106AE16: cp_parser_initializer_clause(cp_parser*, = bool*) (parser.cc:26126) =3D=3D1836=3D=3D Address 0x53dce10 is in a rw- anonymous segment =3D=3D1836=3D=3D=20 =3D=3D1836=3D=3D Invalid read of size 2 =3D=3D1836=3D=3D at 0x10D80F8: tree_check (tree.h:3611) =3D=3D1836=3D=3D by 0x10D80F8: get_partial_spec_bindings(tree_node*, tre= e_node*, tree_node*) (pt.cc:25875) =3D=3D1836=3D=3D by 0x10D890D: most_specialized_partial_spec(tree_node*,= int, bool) (pt.cc:26190) =3D=3D1836=3D=3D by 0x10D975F: instantiate_template(tree_node*, tree_nod= e*, int) (pt.cc:22074) =3D=3D1836=3D=3D by 0x113558A: finish_id_expression_1(tree_node*, tree_n= ode*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) (semantics.cc:4392) =3D=3D1836=3D=3D by 0x1135F66: finish_id_expression(tree_node*, tree_nod= e*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) (semantics.cc:4573) =3D=3D1836=3D=3D by 0x107D2DA: cp_parser_primary_expression(cp_parser*, = bool, bool, bool, bool, cp_id_kind*) (parser.cc:6300) =3D=3D1836=3D=3D by 0x108A225: cp_parser_postfix_expression(cp_parser*, = bool, bool, bool, bool, cp_id_kind*) (parser.cc:7924) =3D=3D1836=3D=3D by 0x106805C: cp_parser_binary_expression(cp_parser*, b= ool, bool, bool, cp_parser_prec, cp_id_kind*) (parser.cc:10383) =3D=3D1836=3D=3D by 0x1068D62: cp_parser_assignment_expression(cp_parser= *, cp_id_kind*, bool, bool) (parser.cc:10727) =3D=3D1836=3D=3D by 0x1069E85: cp_parser_constant_expression(cp_parser*,= int, bool*, bool) (parser.cc:11017) =3D=3D1836=3D=3D by 0x106AE16: cp_parser_initializer_clause(cp_parser*, = bool*) (parser.cc:26126) =3D=3D1836=3D=3D by 0x106FA94: cp_parser_initializer(cp_parser*, bool*, = bool*, bool) (parser.cc:26065) =3D=3D1836=3D=3D Address 0x0 is not stack'd, malloc'd or (recently) free'd =3D=3D1836=3D=3D=20 testcase.C:5:35: internal compiler error: Segmentation fault 5 | template T *t =3D t | ^~~~~~ 0x18044bf crash_signal /repo/gcc-trunk/gcc/toplev.cc:317 0x10d80f8 tree_check(tree_node*, char const*, int, char const*, tree_code) /repo/gcc-trunk/gcc/tree.h:3611 0x10d80f8 get_partial_spec_bindings /repo/gcc-trunk/gcc/cp/pt.cc:25875 0x10d890d most_specialized_partial_spec(tree_node*, int, bool) /repo/gcc-trunk/gcc/cp/pt.cc:26190 ... $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=3D/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g= cc COLLECT_LTO_WRAPPER=3D/repo/gcc-trunk/binary-trunk-r14-8419-20240125172014-= gc6c2a1d79eb-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc= /x86_64-pc-linux-gnu/14.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=3Dc,c++ --enable-valgrind-annotations --disable-nls --enable-checking=3Dyes,rtl,df,= extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=3Dx86_64-pc-linux-gnu --host=3Dx86_64-pc-linux-gnu --target=3Dx86_64-pc-linux-gnu --with-ld=3D/usr/bin/x86_64-pc-linux-gnu-ld --with-as=3D/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=3D/repo/gcc-trunk//binary-trunk-r14-8419-20240125172014-gc6c2a1d79= eb-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240125 (experimental) (GCC)=