fix for __sanitizer_struct_mallinfo with mallinfo2

Message ID CAHiT=DHPmR-Rs2vT4hbq0pvPsbMthqpFPtfJ6GAUHhWxf31mLg@mail.gmail.com
State New
Headers
Series fix for __sanitizer_struct_mallinfo with mallinfo2 |

Commit Message

Reini Urban March 20, 2023, 6:07 a.m. UTC
  Fix sanititzers with mallinfo2
e.g fedora already uses mallinfo2 with long v[10];
  

Comments

Andrew Pinski March 20, 2023, 6:23 p.m. UTC | #1
On Sun, Mar 19, 2023 at 11:08 PM Reini Urban via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Fix sanititzers with mallinfo2
> e.g fedora already uses mallinfo2 with long v[10];

Parts of these patches should go upstream first.

Thanks,
Andrew

>
> --
> Reini Urban
  

Patch

From 6e1ab452bcf2bae0be20faf65966c8ee2f755a2b Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpan.org>
Date: Sun, 20 Feb 2022 18:27:15 +0100
Subject: [PATCH 2/2] gcc: fixup report_heap_memory_use() without mallinfo2
 decl

gcc/ChangeLog:
	* gcc/ggc-common.cc (report_heap_memory_use): fix
	without mallinfo2 decl

Signed-off-by: Reini Urban <rurban@cpan.org>
---
 gcc/ggc-common.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git gcc/ggc-common.cc gcc/ggc-common.cc
index db317f49993..9cd446995f8 100644
--- gcc/ggc-common.cc
+++ gcc/ggc-common.cc
@@ -1276,7 +1276,7 @@  void
 report_heap_memory_use ()
 {
 #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
-#ifdef HAVE_MALLINFO2
+#if defined HAVE_MALLINFO2 && HAVE_DECL_MALLINFO2
   #define MALLINFO_FN mallinfo2
 #else
   #define MALLINFO_FN mallinfo
-- 
2.34.1