diff --git a/tccgen.c b/tccgen.c index 00d3069b..6a870096 100644 --- a/tccgen.c +++ b/tccgen.c @@ -5601,17 +5601,16 @@ ST_FUNC void unary(void) case TOK_builtin_return_address: { int tok1 = tok; - int level; + int64_t level; next(); skip('('); - if (tok != TOK_CINT) { + level = expr_const64(); + if (level < 0) { tcc_error("%s only takes positive integers", tok1 == TOK_builtin_return_address ? "__builtin_return_address" : "__builtin_frame_address"); } - level = (uint32_t)tokc.i; - next(); skip(')'); type.t = VT_VOID; mk_pointer(&type); diff --git a/tests/bug.c b/tests/bug.c index d4e61bcc..b0bc2d54 100644 --- a/tests/bug.c +++ b/tests/bug.c @@ -25,12 +25,6 @@ int compile_errors(void) l1: return 1; l2: return 2; } -#endif -#if TEST == 4 - { - /* Only integer allowed */ - __builtin_return_address(0 + 1) != NULL; - } #endif return 0; }