Skip to content

Commit 805cf87

Browse files
committed
Help the static analyzer
1 parent dac857e commit 805cf87

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/gc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3754,6 +3754,7 @@ static void *gc_perm_alloc_large(size_t sz, int zero, unsigned align, unsigned o
37543754
#endif
37553755
errno = last_errno;
37563756
jl_may_leak(base);
3757+
assert(align > 0);
37573758
unsigned diff = (offset - base) % align;
37583759
return (void*)(base + diff);
37593760
}

src/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ void jl_init_stack_limits(int ismaster, void **stack_lo, void **stack_hi)
101101
struct rlimit rl;
102102
getrlimit(RLIMIT_STACK, &rl);
103103
size_t stacksize = rl.rlim_cur;
104+
// We intentionally leak a stack address here core.StackAddressEscape
105+
#ifndef __clang_analyzer__
104106
*stack_hi = (void*)&stacksize;
105107
*stack_lo = (void*)((char*)*stack_hi - stacksize);
108+
#endif
109+
*stack_hi = 0;
110+
*stack_lo = 0;
106111
#endif
107112
}
108113

0 commit comments

Comments
 (0)