summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gc_config_macros.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
index eba31205..bcd3643a 100644
--- a/include/gc_config_macros.h
+++ b/include/gc_config_macros.h
@@ -287,9 +287,10 @@
/* gcc knows how to retrieve return address, but we don't know */
/* how to generate call stacks. */
# define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
-# if defined(__i386__) || defined(__amd64__) \
- || defined(__x86_64__) /* and probably others... */
-# define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
+# if (__GNUC__ >= 4) && (defined(__i386__) || defined(__amd64__) \
+ || defined(__x86_64__) /* and probably others... */)
+# define GC_RETURN_ADDR_PARENT \
+ (GC_word)__builtin_extract_return_addr(__builtin_return_address(1))
# endif
# else
/* Just pass 0 for gcc compatibility. */