Fixed function pointer usage not marking functions as used
authorRobert Pengelly <robertapengelly@hotmail.com>
Wed, 16 Sep 2026 02:37:34 +0000 (03:37 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Wed, 16 Sep 2026 02:37:34 +0000 (03:37 +0100)
amd64.c

diff --git a/amd64.c b/amd64.c
index 25c9922e5721c195b4cceed4b469e8dd8b3441a7..92b2384206a409dea8d59dc78d5ab21fd6a59a10 100644 (file)
--- a/amd64.c
+++ b/amd64.c
@@ -26641,11 +26641,16 @@ static int amd64_emit_bare_64bit_identifier_to_rax_now (void) {
     
     if (!sym && find_global_symbol (name) >= 0 && get_global_symbol_kind (name) == GLOBAL_SYMBOL_FUNCTION) {
     
-        emit_load_address_to_reg_now ("rax", name);
+        int function_symbol_index = find_global_symbol (name);
+        
+        if (function_symbol_index >= 0) {
+            global_symbols[function_symbol_index].used = 1;
+        }
         
+        emit_load_address_to_reg_now ("rax", name);
         get_token ();
-        free (name);
         
+        free (name);
         return 1;
     
     }