![]() Currently, note_vague_linkage_fn is called on all definitions imported from modules. This is not correct, however; among other things, a gnu_inline function does not have vague linkage, and causes an ICE if its treated as such. There are other things that we seem to potentially miss (e.g. dllexport handling), so it seems sensible to stop trying to manage linkage in such an ad-hoc manner but to use the normal interfaces more often. While looking at this I also found that we seem to miss marking vague linkage variables as COMDAT, so this patch fixes that as well. The change to use expand_or_defer_fn exposes a checking-only ICE in trees_in::assert_definition, where we forget that we already installed a definition for a function. We work around this by instead of clearing DECL_SAVED_TREE entirely in expand_or_defer_fn_1, we instead set it to a dummy value. This way we can also avoid the check for !TREE_ASM_WRITTEN beforehand. PR c++/119154 gcc/cp/ChangeLog: * decl2.cc (vague_linkage_p): Don't treat gnu_inline functions as having vague linkage. * module.cc (trees_out::core_bools): Clear DECL_INTERFACE_KNOWN for vague-linkage entities. (read_var_def): Maybe set comdat linkage for imported var definitions. (module_state::read_cluster): Use expand_or_defer_fn instead of ad-hoc linkage management. (post_load_processing): Likewise. * semantics.cc (expand_or_defer_fn_1): Don't forget that we had a definition at all. gcc/testsuite/ChangeLog: * g++.dg/modules/linkage-3_a.C: New test. * g++.dg/modules/linkage-3_b.C: New test. * g++.dg/modules/pr119154_a.C: New test. * g++.dg/modules/pr119154_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com> |
||
---|---|---|
.forgejo | ||
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgcobol | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.b4-config | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.