On Wed, Oct 15, 2025 at 01:48:49PM +0200, Richard Biener wrote:
> On Wed, 15 Oct 2025, Yury Khrustalev wrote:
>
> > Lack of DW_AT_bit_stride in a DW_TAG_array_type entry causes GDB to infer
> > incorrect element size for vector types. The causes incorrect display of
> > SVE predicate variables as well as out of bounds memory access when reading
> > contents of SVE predicates from memory in GDB.
> >
> > We also locate DIE referenced by DW_AT_type and set DW_AT_bit_size 1 in it.
> >
> > ...
> > + /* Add bit stride information to boolean vectors of single bits so that
> > + elements can be correctly read and displayed by a debugger. */
> > + if (VECTOR_BOOLEAN_TYPE_P (type)
> > + && GET_MODE_CLASS (TYPE_MODE_RAW (type)) == MODE_VECTOR_BOOL)
> > + {
> > + /* MODE_VECTOR_BOOL implies that bit stride and bit size
> > + for element type must be 1. */
>
> Is that so? I thought it wasn't.
In the gcc/mode-classes.def there is:
DEF_MODE_CLASS (MODE_VECTOR_BOOL), /* vectors of single bits */
So, I interpreted "vector of single bits" as bit size=1 and stride=1.
>
> I also think you don't want to look at modes, instead why don't
> you check known_eq (TYPE_PRECISION (TREE_TYPE (type)), 1)?
In v1 of this patch [1], I asked [2] the same thing, and the consensus
seem to have been that we should look at modes precisely to only work on
packed boolean vectors (TYPE_PRECISION of 1 bit is true for them but it
also true for other types).
[1]:
https://inbox.sourceware.org/gcc-patches/[email protected]/
[2]: https://inbox.sourceware.org/gcc-patches/[email protected]/
Thanks,
Yury