From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B807395C80C; Wed, 3 Mar 2021 15:14:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B807395C80C From: "lh_mouse at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/97461] [11 Regression] allocate_gcov_kvp() deadlocks in firefox LTO+PGO build (overridden malloc() recursion) Date: Wed, 03 Mar 2021 15:14:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: patch X-Bugzilla-Severity: normal X-Bugzilla-Who: lh_mouse at 126 dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 15:14:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97461 Liu Hao changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lh_mouse at 126 dot com --- Comment #31 from Liu Hao --- (In reply to Jakub Jelinek from comment #29) > CCing some folks familiar with Windows, while Martin has committed a mmap > based solution, I think it will not work on Windows, but > CreateFileMapping/MapViewOfFile/UnmapViewOfFile/CloseHandle could be a > Windows replacement for that: > https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565575.html > Can anyone of you please have a look into that? > I don't have access to Windows (and my experience with it is 25+ years old > anyway), and Martin doesn't have either. Windows has native heap management functions [1] so there is no need to play with file mappings like `mmap()`. `malloc(size)` becomes `HeapAlloc(GetProcessHeap(), 0, size)`, and `calloc(nmemb, size)` becomes `HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nmemb * size)` except for the overflow check, and `realloc(ptr, size)` becomes `ptr ? HeapReAlloc(GetProcessHeap(), 0, ptr, s= ize) : HeapAlloc(GetProcessHeap(), 0, size)`, and `free(ptr)` becomes `ptr && HeapFree(GetProcessHeap(), ptr)`. [1] https://docs.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heapa= lloc=