Skip to content

Commit 6980782

Browse files
committed
Revert "Validate argument passed to __builtin_frame_address and __builtin_return_address"
This reverts commit c93112d.
1 parent cf9dae1 commit 6980782

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,11 +1847,6 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
18471847
if (SemaBuiltinOSLogFormat(TheCall))
18481848
return ExprError();
18491849
break;
1850-
case Builtin::BI__builtin_frame_address:
1851-
case Builtin::BI__builtin_return_address:
1852-
if (!SemaBuiltinConstantArgRange(TheCall, 0, 0, 0xFFFF))
1853-
return ExprError();
1854-
break;
18551850
}
18561851

18571852
// Since the target specific builtins for each arch overlap, only check those
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify %s
2-
3-
void a(unsigned x) {
2+
void* a(unsigned x) {
43
return __builtin_return_address(0);
54
}
65

@@ -9,30 +8,9 @@ return __builtin_return_address(x); // expected-error{{argument to '__builtin_re
98
}
109

1110
void* c(unsigned x) {
12-
// expected-error@+1 {{argument value 4294967295 is outside the valid range [0, 65535]}}
13-
return __builtin_return_address(-1);
14-
}
15-
16-
void* d(unsigned x) {
17-
// expected-error@+1 {{argument value 1048575 is outside the valid range [0, 65535]}}
18-
return __builtin_return_address(0xFFFFF);
19-
}
20-
21-
void* e(unsigned x) {
2211
return __builtin_frame_address(0);
2312
}
2413

25-
void f(unsigned x) {
26-
// expected-error@+1 {{argument to '__builtin_frame_address' must be a constant integer}}
27-
return __builtin_frame_address(x);
28-
}
29-
30-
void* g(unsigned x) {
31-
// expected-error@+1 {{argument value 4294967295 is outside the valid range [0, 65535]}}
32-
return __builtin_frame_address(-1);
33-
}
34-
35-
void* h(unsigned x) {
36-
// expected-error@+1 {{argument value 1048575 is outside the valid range [0, 65535]}}
37-
return __builtin_frame_address(0xFFFFF);
14+
void d(unsigned x) {
15+
return __builtin_frame_address(x); // expected-error{{argument to '__builtin_frame_address' must be a constant integer}}
3816
}

0 commit comments

Comments
 (0)