From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 869D13896C17; Mon, 8 Feb 2021 10:42:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 869D13896C17 From: "boris at kolpackov dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/98882] [11 Regression] ICE in in cpp_directive_only_process on empty translation unit Date: Mon, 08 Feb 2021 10:42:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: boris at kolpackov dot net X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2021 10:42:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98882 --- Comment #6 from Boris Kolpackov --- After this change I now get an ICE (that same assert) when partially preprocessing (-E -fdirectives-only) a TU that has an include directive tha= t is translated to an import: cat <hello.hxx void f (); EOF cat <main.cxx #include "hello.hxx" //import "hello.hxx"; int main () {} EOF cat <mapper #!/usr/bin/env bash function info () { echo "$*" 1>&2; } function resp () { info " < $*"; echo "$*"; } while read l; do info " > $l" case "$l" in HELLO*) resp "HELLO 1 test ;" ;; MODULE-REPO) resp "PATHNAME /" ;; INCLUDE-TRANSLATE*hello.hxx) resp "PATHNAME $(pwd)/hello.gcm" ;; INCLUDE-TRANSLATE*) resp "BOOL FALSE" ;; MODULE-EXPORT*|MODULE-IMPORT*) resp "PATHNAME $(pwd)/hello.gcm" ;; MODULE-COMPILED*) resp "OK" ;; *) resp "ERROR 'unexpected request: $l'" ;; esac done EOF chmod ugo+x ./mapper g++ -std=3Dc++2a -fmodules-ts -fmodule-mapper=3D'|./mapper' -fmodule-header= -x c++-header hello.hxx g++ -std=3Dc++2a -fmodules-ts -fmodule-mapper=3D'|./mapper' -E -fdirectives= -only -x c++ -o main.ii main.cxx main.cxx:1: internal compiler error: in cpp_directive_only_process, at libcpp/lex.c:4323 0x2c26a7a cpp_directive_only_process(cpp_reader*, void*, void (*)(cpp_reade= r*, CPP_DO_task, void*, ...)) ../../gcc/libcpp/lex.c:4323 0xf1745e scan_translation_unit_directives_only ../../gcc/gcc/c-family/c-ppoutput.c:402 0xf16928 preprocess_file(cpp_reader*) ../../gcc/gcc/c-family/c-ppoutput.c:100 0xf10e2b c_common_init() ../../gcc/gcc/c-family/c-opts.c:1195 0xbe8ea7 cxx_init() ../../gcc/gcc/cp/lex.c:332 0x180c1af lang_dependent_init ../../gcc/gcc/toplev.c:1881 0x180ca61 do_compile ../../gcc/gcc/toplev.c:2178 Note that there is no assert if we are using import directly, without inclu= de translation.=