Skip to content

Conversation

@saeednj
Copy link
Contributor

@saeednj saeednj commented Nov 26, 2019

This is to update the tests to match the new handling of empty and invalid ranges. The corresponding code for the new handling is in this pull-request.

@saeednj saeednj requested a review from dtarditi November 26, 2019 00:08
Copy link
Member

@dtarditi dtarditi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few suggestions for improvements and a question about why a new flag was added to some command lines.


// assignment through pointer
*t1 = 1; // expected-error {{expression has unknown bounds}}
*t2 = 2; // expected-warning {{out-of-bounds memory access}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you file a GitHub issue for this? We should give an error when assign a non-zero value to the upper bound of an nt_array_ptr.

// The following lines are for the clang automated test suite.
//
// RUN: %clang %s -o %t1 -DTEST_READ -Werror -Wno-unused-value -Wno-check-memory-accesses %checkedc_target_flags
// RUN: %clang %s -o %t1 -DTEST_READ -Werror -Wno-unused-value -Wno-check-memory-accesses -Wno-check-bounds-decls-unchecked-scope %checkedc_target_flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the flag -Wno-check-memory-accesses can be deleted from all of these command lines. I am surprised you had to add -Wno-check-bounds-decls-unchecked-scope. Were there specific lines in the file that triggered this warning?

Copy link
Contributor Author

@saeednj saeednj Nov 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -Wno-check-bounds-decls-unchecked-scope was needed because in cases that we see an invalid range declaration, we give a warning and this flag ignores that warning. For example, for the declaration at line 226 of deref.c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, -Wno-check-memory-accesses was for out-of-bounds memory access warnings.
I removed them.

// The following lines are for the clang automated test suite.
//
// RUN: %clang %S/deref.c -o %t1 -DTEST_READ -Werror -Wno-unused-value -Wno-check-memory-accesses -O3 %checkedc_target_flags
// RUN: %clang %S/deref.c -o %t1 -DTEST_READ -Werror -Wno-unused-value -Wno-check-memory-accesses -Wno-check-bounds-decls-unchecked-scope -O3 %checkedc_target_flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments for deref.c apply to this file too.

Copy link
Contributor Author

@saeednj saeednj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions.

The added flag was for checking invalid range declarations.

Copy link
Member

@dtarditi dtarditi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants