================
@@ -36,3 +36,8 @@ void* h(unsigned x) {
 // expected-error@+1 {{argument value 1048575 is outside the valid range [0, 
65535]}}
 return __builtin_frame_address(0xFFFFF);
 }
+
+void *i() {
+// expected-error@+1 {{too many arguments to function call, expected 0, have 
1}}
+return __builtin_stack_address(0);
----------------
moorabbit wrote:

> // As a global variable where there is no stack address to get.
// This should be diagnosed as an error?
void *ptr = __builtin_stack_address();

It looks like GCC doesn't diagnose this as an error 
(https://godbolt.org/z/x35e114de) and returns the stack address of the 
initialization function. I'm not sure if it's intended or not.
Should we still diagnose this as an error?

> Should we also have tests for what happens with naked functions or other kind 
> of odd situations where the stack may be different from the normal case?

Noted, will add them, thanks!

https://github.com/llvm/llvm-project/pull/148281
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to