![]() The following (first) testcase is accepted by clang (if clang::musttail) and rejected by gcc, because we discover the call is noreturn and then bail out because we don't want noreturn tailcalls. The general reason not to support noreturn tail calls is for cases like abort where we want nicer backtrace, but if user asks explicitly to musttail a call which either is explicitly noreturn or is implicitly determined to be noreturn, I don't see a reason why we couldn't do that. Both for tail calls and tail recursions. An alternative would be to keep rejecting musttail to explicit noreturn, but not actually implicitly mark anything as noreturn if it has any musttail calls. But it is unclear how we could do that, such marking is I think done typically before IPA and e.g. for LTO we won't know whether some other TU could have musttail calls to it. And keeping around both explicit and implicit noreturn bits would be ugly. Well, I guess we could differentiate between presence of noreturn/_Noreturn attributes and just ECF_NORETURN without those, but then tailc would still need to support it, just error out if it was explicit. 2025-03-28 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119483 * tree-tailcall.cc (find_tail_calls): Handle noreturn musttail calls. (eliminate_tail_call): Likewise. (tree_optimize_tail_calls_1): If cfun->has_musttail and diag_musttail, handle also basic blocks with no successors with noreturn musttail calls. * calls.cc (can_implement_as_sibling_call_p): Allow ECF_NORETURN calls if they are musttail calls. * c-c++-common/pr119483-1.c: New test. * c-c++-common/pr119483-2.c: New test. |
||
---|---|---|
.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.