https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121964
Bug ID: 121964 Summary: aarch64: SVE predicate variables are printed incorrectly Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: ykhrustalev at gcc dot gnu.org Target Milestone: --- Variables of type svbool_t are not displayed correctly in a debugger (e.g. GDB). A debugger would read 8 bits for each predicate element (that has bitsize 1 bit) which would result in interpreting some elements incorrectly and also reading beyond the buffer bounds. This is due to lack of the DW_AT_bit_stride attribute in the DWARF entry for the vector type svbool_t. Reproducer: ``` /* File: predicate.cpp */ #include <cstdio> #include <arm_sve.h> [[gnu::target ("arch=armv9-a+sve")]] void fun () { // 0b ____'____'____'____'____'____'____'_111 volatile svbool_t pred8 = svwhilelt_b8_u32 (0u, 3u); // 0b ____'____'____'____'____'____'___1'_1_1 volatile svbool_t pred16 = svwhilelt_b16_u32 (0u, 3u); // 0b ____'____'____'____'____'___1'___1'___1 volatile svbool_t pred32 = svwhilelt_b32_u32 (0u, 3u); // 0b ____'____'____'___1'____'___1'____'___1 volatile svbool_t pred64 = svwhilelt_b64_u32 (0u, 3u); } [[gnu::target("arch=armv9-a+sve")]] int main () { printf ("vector length: %lu bits\n", svcntw () * 32); fun (); return 0; } ``` Compile with ``` g++ -g predicate.cpp -o predicate ``` See comments above the variables for the expected data (based on VLEN = 256 bits that gives 32 bits for the length of predicate registers): `_` means `0` and `1` means `1`, LSB on the right. Compare "p/t *(uint64_t*)&pred16" and "p pred16" in GDB: should show the same data but doesn't. Note: this was originally reported (incorrectly) as a GDB bug [1] but the issue is on the GCC side. [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=33233