Skip to content

Commit

Permalink
Add test missed in r843a9778fcd5
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D75768
  • Loading branch information
jstengleingithub authored and Erich Keane committed Mar 9, 2020
1 parent 45555c3 commit 90e791d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions clang/test/Sema/builtin-returnaddress.c
@@ -0,0 +1,19 @@
// RUN: %clang_cc1 -fsyntax-only -Wframe-address -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wmost -verify %s

void* a(unsigned x) {
return __builtin_return_address(0);
}

void* b(unsigned x) {
return __builtin_return_address(1); // expected-warning{{calling '__builtin_return_address' with a nonzero argument is unsafe}}
}

void* c(unsigned x) {
return __builtin_frame_address(0);
}

void* d(unsigned x) {
return __builtin_frame_address(1); // expected-warning{{calling '__builtin_frame_address' with a nonzero argument is unsafe}}
}

0 comments on commit 90e791d

Please sign in to comment.