summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-02-07 16:07:54 +0100
committerYves Orton <demerphq@gmail.com>2023-02-08 11:48:11 +0800
commit9d3a26c75c777cb4dc1382d59de52a9b69a38f14 (patch)
tree1b03b22639b9ae8c0c2bd93ac18d2c9e23f0ee66
parentdd3d299fefbbff9efe55eb16af5bb9aa0410d606 (diff)
downloadperl-9d3a26c75c777cb4dc1382d59de52a9b69a38f14.tar.gz
util.c - move was_here to be initialized earlier
Otherwise the goto out_of_memory breaks threaded builds under debugging as originally reported by Karl as we jump over the initialization of the variable and then use it later on. util.c: In function ‘void* Perl_safesysrealloc(void*, size_t)’: util.c:335:11: error: jump to label ‘out_of_memory’ 335 | out_of_memory: | ^~~~~~~~~~~~~ util.c:248:18: note: from here 248 | goto out_of_memory; | ^~~~~~~~~~~~~ util.c:277:12: note: crosses initialization of ‘UV was_where’ 277 | UV was_where = PTR2UV(where); | ^~~~~~~~~ make: *** [makefile:260: util.o] Error 1
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 9667e0f4a8..c765e159e0 100644
--- a/util.c
+++ b/util.c
@@ -242,6 +242,7 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size)
}
else {
dSAVE_ERRNO;
+ PERL_DEB(UV was_where = PTR2UV(where)); /* used in diags below */
#ifdef USE_MDH
where = (Malloc_t)((char*)where-PERL_MEMORY_DEBUG_HEADER_SIZE);
if (size + PERL_MEMORY_DEBUG_HEADER_SIZE < size)
@@ -274,7 +275,6 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size)
#ifdef DEBUGGING
if ((SSize_t)size < 0)
Perl_croak_nocontext("panic: realloc, size=%" UVuf, (UV)size);
- UV was_where = PTR2UV(where);
#endif
#ifdef PERL_DEBUG_READONLY_COW
if ((ptr = mmap(0, size, PROT_READ|PROT_WRITE,