diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-02-08 22:17:28 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-02-08 22:17:28 +0300 |
commit | dac8f776145e437de006fe416b4cf0678b5f9523 (patch) | |
tree | 6bb9b73ead0fda4194d77720937a9306bd764072 /finalize.c | |
parent | be9b47f7694b6302b8b30f5c1687611576d92ebe (diff) | |
download | bdwgc-dac8f776145e437de006fe416b4cf0678b5f9523.tar.gz |
Fix GC_unreachable_finalize_mark_proc to ensure its unique address
Even GC_unreachable_finalize_mark_proc and GC_normal_finalize_mark_proc
have identical behavior, their addresses should be guaranteed to be
distinct despite any potential compiler optimization.
* finalize.c (GC_unreachable_finalize_mark_proc): Add a dummy statement
before GC_normal_finalize_mark_proc() call; add comment.
Diffstat (limited to 'finalize.c')
-rw-r--r-- | finalize.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -657,6 +657,11 @@ STATIC void GC_null_finalize_mark_proc(ptr_t p) /* other objects specify no ordering. */ STATIC void GC_unreachable_finalize_mark_proc(ptr_t p) { + /* A dummy comparison to ensure the compiler not to optimize two */ + /* identical functions into a single one (thus, to ensure a unique */ + /* address of each). Alternatively, GC_noop1(p) could be used. */ + if (EXPECT(NULL == p, FALSE)) return; + GC_normal_finalize_mark_proc(p); } |