-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker option moved to configuration option
- Loading branch information
Showing
8 changed files
with
115 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -analyzer-config suppress-all-address-spaces=false -verify=x86-nosuppress %s | ||
// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -verify=x86-suppress %s | ||
// RUN: %clang_analyze_cc1 -triple arm-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -analyzer-config suppress-all-address-spaces=false -verify=other-nosuppress %s | ||
// RUN: %clang_analyze_cc1 -triple arm-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -verify=other-suppress %s | ||
|
||
#define AS_ATTRIBUTE(_X) volatile __attribute__((address_space(_X))) | ||
|
||
#define _get_base() ((void * AS_ATTRIBUTE(256) *)0) | ||
|
||
void* test_address_space_array(unsigned long slot) { | ||
return _get_base()[slot]; // other-nosuppress-warning{{Dereference}} | ||
} | ||
|
||
void test_address_space_condition(int AS_ATTRIBUTE(257) *cpu_data) { | ||
if (cpu_data == 0) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} | ||
} | ||
} | ||
|
||
struct X { int member; }; | ||
int test_address_space_member(void) { | ||
struct X AS_ATTRIBUTE(258) *data = (struct X AS_ATTRIBUTE(258) *)0UL; | ||
int ret; | ||
ret = data->member; // other-nosuppress-warning{{Dereference}} | ||
return ret; | ||
} | ||
|
||
void test_other_address_space_condition(int AS_ATTRIBUTE(259) *cpu_data) { | ||
if (cpu_data == 0) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} \ | ||
// x86-nosuppress-warning{{Dereference}} | ||
} | ||
} | ||
|
||
void test_no_address_space_condition(int *cpu_data) { | ||
if (cpu_data == 0) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} \ | ||
// x86-nosuppress-warning{{Dereference}} \ | ||
// other-suppress-warning{{Dereference}} \ | ||
// x86-suppress-warning{{Dereference}} | ||
} | ||
} | ||
|
||
#define _fixed_get_base() ((void * AS_ATTRIBUTE(256) *)2) | ||
|
||
void* fixed_test_address_space_array(unsigned long slot) { | ||
return _fixed_get_base()[slot]; // other-nosuppress-warning{{Dereference}} | ||
} | ||
|
||
void fixed_test_address_space_condition(int AS_ATTRIBUTE(257) *cpu_data) { | ||
if (cpu_data == (int AS_ATTRIBUTE(257) *)2) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} | ||
} | ||
} | ||
|
||
int fixed_test_address_space_member(void) { | ||
struct X AS_ATTRIBUTE(258) *data = (struct X AS_ATTRIBUTE(258) *)2UL; | ||
int ret; | ||
ret = data->member; // other-nosuppress-warning{{Dereference}} | ||
return ret; | ||
} | ||
|
||
void fixed_test_other_address_space_condition(int AS_ATTRIBUTE(259) *cpu_data) { | ||
if (cpu_data == (int AS_ATTRIBUTE(259) *)2) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} \ | ||
// x86-nosuppress-warning{{Dereference}} | ||
} | ||
} | ||
|
||
void fixed_test_no_address_space_condition(int *cpu_data) { | ||
if (cpu_data == (int *)2) { | ||
*cpu_data = 3; // other-nosuppress-warning{{Dereference}} \ | ||
// x86-nosuppress-warning{{Dereference}} \ | ||
// other-suppress-warning{{Dereference}} \ | ||
// x86-suppress-warning{{Dereference}} | ||
} | ||
} |