Sometimes initialize_sanitizer_builtins is not called before emitting
the asan builtins with hwasan. In the case of the bug report, there
was a path with the fortran front-end where it was not called.
So let's call it in asan_instrument before calling transform_statements.

Built and tested for aarch64-linux-gnu with no regressions.

gcc/ChangeLog:

        PR sanitizer/115205
        * asan.cc (asan_instrument): Call initialize_sanitizer_builtins
        for hwasan.

Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
---
 gcc/asan.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/asan.cc b/gcc/asan.cc
index 9e0f51b1477..c684ca6d366 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -4276,6 +4276,7 @@ asan_instrument (void)
 {
   if (hwasan_sanitize_p ())
     {
+      initialize_sanitizer_builtins ();
       transform_statements ();
       return 0;
     }
-- 
2.43.0

Reply via email to