================
@@ -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);
----------------
AaronBallman wrote:

```suggestion
  // expected-error@+1 {{too many arguments to function call, expected 0, have 
1}}
  return __builtin_stack_address(0);
```
Other test cases I would like to see are:
```
 // As a global variable where there is no stack address to get.
// This should be diagnosed as an error?
void *ptr = __builtin_stack_address();

inline void *what() {
  return __builtin_stack_address();
}

void func() {
  void *ptr = what(); // Is this getting the stack address of? The inline 
function or is it getting the stack address of the caller? Or depends on 
optimization level?
}
```
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?

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