Skip to content

How should __builtin_object_size treat casts in the type & 1 == 1 case? #96737

@zygoloid

Description

@zygoloid

Originally posted by @bwendling in #96573 (comment):

I have a question about the "sub-object" part. Do we attempt to discover the sub-object past any casting? A motivating example:

char mux[10][10][10];

printf("%ld\n", __builtin_dynamic_object_size(&((char *)&mux[1][1])[var], 1));

GCC prints 89 (when var is 1). In the changes I'm making to the sub-object calculations, I want to say that this should print 9, because the sub-object is mux[1][1] and not a one-dimensional array. There could be arguments made for both options, so I'd like to get everyone's opinions.

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions