mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-04 12:11:10 +08:00
With -fno-delete-null-pointer-checks which is e.g. implied by -fsanitize=undefined or default on some embedded targets, the middle-end folder doesn't consider addresses of global VAR_DECLs to be non-NULL, as one of them could have address 0. Still, I think malloc/operator new (at least the nonthrowing) relies on NULL returns meaning allocation failure rather than success. Furthermore, the artificial VAR_DECLs we create for constexpr new never actually live in the address space of the program, so we can pretend they will never be NULL too. > I'm surprised that nonzero_address has such a limited set of things it will > actually believe have non-zero addresses with > -fno-delete-null-pointer-checks. But it seems that we should be able to > arrange to satisfy > > > if (definition && !DECL_EXTERNAL (decl) > > since these "variables" are indeed defined within the current translation > unit. Doing that seems to work and as added benefit it fixes another PR that has been filed recently. I need to create the varpool node explicitly and call a method that sets the definition member in there, but I can also unregister those varpool nodes at the end of constexpr processing, as the processing ensured they don't leak outside of the processing. 2021-02-10 Jakub Jelinek <jakub@redhat.com> PR c++/98988 PR c++/99031 * constexpr.c: Include cgraph.h. (cxx_eval_call_expression): Call varpool_node::finalize_decl on heap artificial vars. (cxx_eval_outermost_constant_expr): Remove varpool nodes for heap artificial vars. * g++.dg/cpp2a/constexpr-new16.C: New test. * g++.dg/cpp2a/constexpr-new17.C: New test.
…
…
…
…
…
…
…
…
…
…
…
…
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.
Description
Languages
C++
31.9%
C
31.3%
Ada
12%
D
6.5%
Go
6.4%
Other
11.5%