public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99050] New: [modules] ICE in cpp_directive_only_process on include translation
@ 2021-02-10  5:20 boris at kolpackov dot net
  2021-02-16 20:27 ` [Bug c++/99050] " nathan at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: boris at kolpackov dot net @ 2021-02-10  5:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99050
           Summary: [modules] ICE in cpp_directive_only_process on include
                    translation
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boris at kolpackov dot net
  Target Milestone: ---

After the fix in bug 98882 I now get an ICE (that same assert) when partially
preprocessing (-E -fdirectives-only) a TU that has an include directive that is
translated to an import:

cat <<EOF >hello.hxx
void f ();
EOF

cat <<EOF >main.cxx
#include "hello.hxx"
//import "hello.hxx";

int main () {}
EOF

cat <<EOF >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=c++2a -fmodules-ts -fmodule-mapper='|./mapper' -fmodule-header -x c++
header hello.hxx
g++ -std=c++2a -fmodules-ts -fmodule-mapper='|./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_reader*,
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 include
translation.

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

end of thread, other threads:[~2021-02-17  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  5:20 [Bug c++/99050] New: [modules] ICE in cpp_directive_only_process on include translation boris at kolpackov dot net
2021-02-16 20:27 ` [Bug c++/99050] " nathan at gcc dot gnu.org
2021-02-17  6:29 ` boris at kolpackov dot net
2021-02-17  9:21 ` jakub 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).