[Bug c++/98843] Building simple c++ modules example fails but successful with -save-temps

2021-01-26 Thread gcc at boltav dot me.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98843

--- Comment #1 from gazzatav  ---
Created attachment 50064
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50064=edit
mod.ii, main.ii - tmp files required by guidelines, a-iostream.ii too large

[Bug c++/98843] New: Building simple c++ modules example fails but successful with -save-temps

2021-01-26 Thread gcc at boltav dot me.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98843

Bug ID: 98843
   Summary: Building simple c++ modules example fails but
successful with -save-temps
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc at boltav dot me.uk
  Target Milestone: ---

Checked out and built:
g++ (GCC) 11.0.0 20210125 (experimental)
@ commit a61efd469371b71483d42afa1038e6a8c16baf4a (HEAD -> master,
origin/master, origin/HEAD)

When I try to build the sources below, the build fails.  However when I added
-save-temps for this bug report the build succeeded!

sources below from https://vector-of-bool.github.io/2019/03/10/modules-1.html

source - mod.cpp

export module speech;
export const char* get_phrase() {
return "Hello, world!";
}

source - main.cpp

// main.cpp
import speech;
import ;
int main() {
std::cout << get_phrase() << '\n';
}

Commands for build:

g++ --version
g++ -c -std=c++20 -fmodules-ts -o mod.o ../src/mod.cpp
g++  -std=c++20 -fmodules-ts -x c++-system-header iostream
g++ -c -std=c++20 -fmodules-ts -o main.o ../src/main.cpp

Diagnostic:

g++ (GCC) 11.0.0 20210125 (experimental)
Copyright © 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

‘
In file included from
/home/gary/Projects/g++mod/install/20210125/include/c++/11.0.0/bits/ios_base.h:46,
 from
/home/gary/Projects/g++mod/install/20210125/include/c++/11.0.0/ios:42,
 from
/home/gary/Projects/g++mod/install/20210125/include/c++/11.0.0/ostream:38,
 from
/home/gary/Projects/g++mod/install/20210125/include/c++/11.0.0/iostream:39,
of module
/home/gary/Projects/g++mod/install/20210125/include/c++/11.0.0/iostream,
imported at /home/gary/Projects/module-test/builds/../src/main.cpp:4:
in import_entity_module, at cp/module.cc:4083
  189 | templatehttps://gcc.gnu.org/bugs/> for instructions.


Build dir layout after (because modules):

$ tree
.
├── gcm.cache
│   ├── home
│   │   └── gary
│   │   └── Projects
│   │   └── g++mod
│   │   └── install
│   │   └── 20210125
│   │   └── include
│   │   └── c++
│   │   └── 11.0.0
│   │   └── iostream.gcm
│   └── speech.gcm
├── mod.o
└── mods.sh

System:
Linux 5.4.0-64-generic #72~18.04.1-Ubuntu SMP Fri Jan 15 14:06:34 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux

Version and options:

→ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--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-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --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 --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)