public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-325] middle-end/70090: Register __bdos for sanitizers if necessary
@ 2022-05-11 13:43 Siddhesh Poyarekar
0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2022-05-11 13:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:546c6210eb08f583ee4f53a0fd7886b6c958c7fa
commit r13-325-g546c6210eb08f583ee4f53a0fd7886b6c958c7fa
Author: Siddhesh Poyarekar <siddhesh@gotplt.org>
Date: Wed May 11 19:13:09 2022 +0530
middle-end/70090: Register __bdos for sanitizers if necessary
The asan initializer registers __builtin_object_size for languages that
don't have it, e.g. Fortran. Register __builtin_dynamic_object_size too
(we need both because __builtin_dynamic_object_size computation may
involve generating __builtin_object_size as a fallback) so that
gfortran.dg/ubsan/bind-c-intent-out-2.f90 does not crash anymore.
gcc/ChangeLog:
PR middle-end/70090
* asan.cc (initialize_sanitizer_builtins): Register
__builtin_dynamic_object_size if necessary.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Diff:
---
gcc/asan.cc | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/gcc/asan.cc b/gcc/asan.cc
index ef59b77ebc2..4b583e54efd 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -3457,14 +3457,22 @@ initialize_sanitizer_builtins (void)
#include "sanitizer.def"
- /* -fsanitize=object-size uses __builtin_object_size, but that might
- not be available for e.g. Fortran at this point. We use
- DEF_SANITIZER_BUILTIN here only as a convenience macro. */
- if ((flag_sanitize & SANITIZE_OBJECT_SIZE)
- && !builtin_decl_implicit_p (BUILT_IN_OBJECT_SIZE))
- DEF_SANITIZER_BUILTIN_1 (BUILT_IN_OBJECT_SIZE, "object_size",
- BT_FN_SIZE_CONST_PTR_INT,
- ATTR_PURE_NOTHROW_LEAF_LIST);
+ /* -fsanitize=object-size uses __builtin_dynamic_object_size and
+ __builtin_object_size, but they might not be available for e.g. Fortran at
+ this point. We use DEF_SANITIZER_BUILTIN here only as a convenience
+ macro. */
+ if (flag_sanitize & SANITIZE_OBJECT_SIZE)
+ {
+ if (!builtin_decl_implicit_p (BUILT_IN_OBJECT_SIZE))
+ DEF_SANITIZER_BUILTIN_1 (BUILT_IN_OBJECT_SIZE, "object_size",
+ BT_FN_SIZE_CONST_PTR_INT,
+ ATTR_PURE_NOTHROW_LEAF_LIST);
+ if (!builtin_decl_implicit_p (BUILT_IN_DYNAMIC_OBJECT_SIZE))
+ DEF_SANITIZER_BUILTIN_1 (BUILT_IN_DYNAMIC_OBJECT_SIZE,
+ "dynamic_object_size",
+ BT_FN_SIZE_CONST_PTR_INT,
+ ATTR_PURE_NOTHROW_LEAF_LIST);
+ }
#undef DEF_SANITIZER_BUILTIN_1
#undef DEF_SANITIZER_BUILTIN
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-11 13:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 13:43 [gcc r13-325] middle-end/70090: Register __bdos for sanitizers if necessary Siddhesh Poyarekar
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).