Skip to content

CheckedRegionFinder: "void" does not contain an unchecked pointer. #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions clang/lib/3C/CheckedRegions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,6 @@ bool CheckedRegionFinder::containsUncheckedPtrAcc(QualType Qt,
if (Ct->isVoidPointerType()) {
return true;
}
if (Ct->isVoidType()) {
return true;
}
if (Ct->isPointerType()) {
return containsUncheckedPtrAcc(Ct->getPointeeType(), Seen);
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/3C/base_subdir/canwrite_constraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

int *bar(int *q) {
// CHECK_LOWER: int *bar(int *q : itype(_Ptr<int>)) : itype(_Ptr<int>) {
// CHECK_HIGHER: _Ptr<int> bar(_Ptr<int> q) {
// CHECK_HIGHER: _Ptr<int> bar(_Ptr<int> q) _Checked {
foo(q);
return foo_var;
}
30 changes: 26 additions & 4 deletions clang/test/3C/graphs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,41 +99,63 @@ int pop(struct Stack*);
int main()

{
//CHECK_NOALL: {
//CHECK_ALL: _Checked {

int vertices,edges,i,src,dst;

printf("Enter the number of vertices\n");
//CHECK_NOALL: printf("Enter the number of vertices\n");
//CHECK_ALL: _Unchecked { printf("Enter the number of vertices\n"); };

scanf("%d",&vertices);
//CHECK_NOALL: scanf("%d",&vertices);
//CHECK_ALL: _Unchecked { scanf("%d",&vertices); };

struct Graph* graph = createGraph(vertices);
//CHECK: _Ptr<struct Graph> graph = createGraph(vertices);

printf("Enter the number of edges\n");
//CHECK_NOALL: printf("Enter the number of edges\n");
//CHECK_ALL: _Unchecked { printf("Enter the number of edges\n"); };

scanf("%d",&edges);
//CHECK_NOALL: scanf("%d",&edges);
//CHECK_ALL: _Unchecked { scanf("%d",&edges); };

for(i=0; i<edges; i++)

{

printf("Edge %d \nEnter source: ",i+1);
//CHECK_NOALL: printf("Edge %d \nEnter source: ",i+1);
//CHECK_ALL: _Unchecked { printf("Edge %d \nEnter source: ",i+1); };

scanf("%d",&src);
//CHECK_NOALL: scanf("%d",&src);
//CHECK_ALL: _Unchecked { scanf("%d",&src); };

printf("Enter destination: ");
//CHECK_NOALL: printf("Enter destination: ");
//CHECK_ALL: _Unchecked { printf("Enter destination: "); };

scanf("%d",&dst);
//CHECK_NOALL: scanf("%d",&dst);
//CHECK_ALL: _Unchecked { scanf("%d",&dst); };

addEdge(graph, src, dst);

}

printf("One topological sort order is:\n");
//CHECK_NOALL: printf("One topological sort order is:\n");
//CHECK_ALL: _Unchecked { printf("One topological sort order is:\n"); };

topologicalSort(graph);

printf("\n");
//CHECK_NOALL: printf("\n");
//CHECK_ALL: _Unchecked { printf("\n"); };



Expand All @@ -151,10 +173,14 @@ int main()
addEdge(graph2, 2, 3);

printf("One topological sort is:\n");
//CHECK_NOALL: printf("One topological sort is:\n");
//CHECK_ALL: _Unchecked { printf("One topological sort is:\n"); };

topologicalSort(graph2);

printf("\n");
//CHECK_NOALL: printf("\n");
//CHECK_ALL: _Unchecked { printf("\n"); };

return 0;

Expand Down Expand Up @@ -185,8 +211,6 @@ void topologicalSortHelper(int vertex, struct Graph* graph, struct Stack* stack)
int connectedVertex = temp->vertex;

if(graph->visited[connectedVertex] == 0) {
//CHECK_NOALL: if(graph->visited[connectedVertex] == 0) {
//CHECK_ALL: if(graph->visited[connectedVertex] == 0) _Unchecked {

topologicalSortHelper(connectedVertex, graph, stack);

Expand Down Expand Up @@ -227,8 +251,6 @@ void topologicalSort(struct Graph* graph)
if(graph->visited[i]==0)

{
//CHECK_NOALL: {
//CHECK_ALL: _Unchecked {

topologicalSortHelper(i,graph,stack);

Expand Down
2 changes: 1 addition & 1 deletion clang/test/3C/subtyp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void take(int *p : itype(_Nt_array_ptr<int>));
//CHECK: void take(int *p : itype(_Nt_array_ptr<int>));
int *foo(int *x) {
//CHECK_NOALL: int *foo(int *x : itype(_Ptr<int>)) : itype(_Ptr<int>) {
//CHECK_ALL: _Nt_array_ptr<int> foo(_Nt_array_ptr<int> x) {
//CHECK_ALL: _Nt_array_ptr<int> foo(_Nt_array_ptr<int> x) _Checked {
take(x);
return x;
}
Expand Down
12 changes: 6 additions & 6 deletions clang/test/3C/supernested.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ do_sanity_checks(void)
{
//CHECK: _Checked {
{
//CHECK: _Unchecked {
//CHECK: {
struct vsf_sysutil_statbuf* p_statbuf = 0;
//CHECK: _Ptr<struct vsf_sysutil_statbuf> p_statbuf = 0;
vsf_sysutil_fstat(VSFTP_COMMAND_FD, &p_statbuf);
Expand All @@ -56,28 +56,28 @@ do_sanity_checks(void)
{
if (tunable_local_enable)
{
//CHECK: _Unchecked {
//CHECK: {
die("vsftpd: security: 'one_process_model' is anonymous only");
}
if (!vsf_sysdep_has_capabilities_as_non_root())
{
//CHECK: _Unchecked {
//CHECK: {
die("vsftpd: security: 'one_process_model' needs a better OS");
}
}
if (!tunable_local_enable && !tunable_anonymous_enable)
{
//CHECK: _Unchecked {
//CHECK: {
die("vsftpd: both local and anonymous access disabled!");
}
if (!tunable_ftp_enable && !tunable_http_enable)
{
//CHECK: _Unchecked {
//CHECK: {
die("vsftpd: both FTP and HTTP disabled!");
}
if (tunable_http_enable && !tunable_one_process_model)
{
//CHECK: _Unchecked {
//CHECK: {
die("vsftpd: HTTP needs 'one_process_model' for now");
}
}