/* 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. */