Okay, I now have a suggested fix hint. PTAL.
Please use GitHub pull requests for new patches. Phabricator shutdown timeline
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Fri, Sep 29
FINALLY! found out how to do suggestions for typos.
Thu, Sep 28
Add a "FIXME" to improve the diagnostics with a typo hint.
Move attribute checking over to SemaDeclAttr.cpp
Wed, Sep 27
The GitHub repo with this and the counted_by change: https://github.com/bwendling/llvm-project/tree/array-bounds-remarks-with-counted-by
Use CBA as an acronym of CountedByAttribute instead of EBA, which is oldspeak.
Tue, Sep 26
In D144136#4639907, @kees wrote:Can you refresh this patch to work with https://reviews.llvm.org/D148381 ? My testing seems to imply that it doesn't know the size of the array. I assume the if (!IsUnboundedArray) check is incomplete now. i.e. for a __counted_by array, I see the "unknown" remark:
array-bounds.c:341:2: remark: accessing unknown sized array by 'index - 1' [-Rarray-bounds] 341 | TEST_ACCESS(p, array, index, SHOULD_TRAP); | ^which is from the array-bounds.c test cases:
TEST_SIGNAL(counted_by_enforced_by_sanitizer, SIGILL) { struct annotated *p; int index = MAX_INDEX + unconst; p = alloc_annotated(index); REPORT_SIZE(p->array); TEST_ACCESS(p, array, index, SHOULD_TRAP); }
Thu, Sep 21
Friendly Ping.
Mon, Sep 18
Fri, Sep 15
In D148381#4646780, @kees wrote:In D148381#4645600, @void wrote:Added more error messages. Changed some code around to align with coding practices. Added some more test cases.
Doing a full "allmodconfig" Linux kernel build with my 200ish __counted_by annotations is building cleanly. Yay! :)
Thu, Sep 14
Add release note.
Wed, Sep 13
Added more error messages. Changed some code around to align with coding practices. Added some more test cases.
Tue, Sep 12
This is ready for review. Please take a look.
Fri, Sep 8
Add test output when the attribute isn't used.
Fix docs to use the correct code examples throughout.
I changed more than just the testcase (not a lot, but non-trivial nonetheless). PTAL.
Remove unneded extern decl from test.
- Expand test to show the unsanitized version,
- Unify the ways of finding a specific field based on a predicate,
- Make sure we're using the correct types in a couple of key places.
Wed, Sep 6
In D148381#4639909, @kees wrote:I can generate warnings for anonymous structs were the __counted_by member is reported as "not found". For example:
little.c:7:28: warning: counted_by field 'count' not found 7 | int array[] __counted_by(count); | ^~~~~For this:
#define __counted_by(member) __attribute__((__counted_by__(member))) struct anon { unsigned long flags; struct { unsigned char count; int array[] __counted_by(count); }; }; extern void bar(int input); void foo(struct anon *p, int index) { bar(p->array[index]); }
I'll look into this.
This is now ready for a non-WIP review. PTAL. :-)
Tue, Sep 5
Update documentation. Cribbed off of Qing Zhao's GCC implementation.
Mon, Sep 4
Sep 1 2023
Aug 31 2023
Fix testcase.
Remove un-needed change.
Add a few more tests to the codegen testcase.
Aug 30 2023
Add testcases.
Add more diagnostics.
Aug 29 2023
Fix some issues Nick pointed out.
In D148381#4625462, @nickdesaulniers wrote:I assume you plan to add some clang CodeGen tests at some point?
In D148381#4626229, @serge-sans-paille wrote:Jumping a bit late in the thread, apologize in advance if I missed something.
The GCC version of the attributes seems to be element_count (as found in the link https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 mentionned by @kees) I guess we could align (I personally prefer the GCC name, FWIW)
Aug 28 2023
Move the isFlexibleArrayMemberLike fully into Decl and fix tests.
Aug 25 2023
Modify sanitize scope to avoid the instruction creation.
Aug 22 2023
Fix clang-ast-dump issue.
Address Nick's comments.
Support when doing a _bdos on the full structure.
Fix a segfault.
Aug 21 2023
Make builtin_dynamic_object_size use the counted_by attribute to help determine the object size.
Aug 10 2023
Update to more match Qing's GCC implementation.
Jul 14 2023
Bueno!
I'm not familiar with this code, but why not place the information into ConstantUser instead? Or maybe make the struct a private member of ConstantHoistingPass.
Jul 11 2023
Nice catch!
Rebasing
May 22 2023
Add bounds checking for the "ArrayBounds" saniziter kind.
May 11 2023
Use strings for the attribute argument.
May 4 2023
Use "Expected" for the SourceRange imports.
May 1 2023
Improve error message to use the unknown field's name.
Apr 28 2023
Change sanitizer scope because instructions may be created.
Fix the way the source ranges are imported via the ASTImporter.
Do other minor fixes according to feedback.
Apr 27 2023
Use the new memory location.
This is a precursor to specifying the field with the designated initializer syntax. Therefore, it may be a bit cumbersome.
Fix ICE when the FD isn't found.
Add the ability to specify a "path" to the element count if it resides within a sub-structure.
Apr 18 2023
I think this change is causing build failures. Could you take a look?
Add comment.
Apr 17 2023
Fix failing testcase.
In D148381#4274857, @nickdesaulniers wrote:Cool!
How about some codegen tests?
I'll add those to the next iteration. :-)
Reformat.
Friendly ping.
Apr 14 2023
Note: This is a work-in-progress, so there's no need for a formal review, though any suggestions will definitely be appreciated. :-)
Apr 7 2023
Fix compilation issue.
In D147580#4250232, @shafik wrote:I guess I should have waited till I saw: https://reviews.llvm.org/D147673