Currently, gen_ctf_base_type will obtain the bit_size of a given DWARF DIE based on the system GCC is compiling for. For DIEs with a DW_ATE_float encoding, this is used to determine whether to classify a given DIE as a single, double, or long double. However, on some systems, a long double will not have a bit_size of 128 (usually it will be 80). This means that a __float128 (_Float128) type will not be classified as a long double, and will actually be dropped entirely.
This patch makes an explicit check for a float with a bit_size of 128, in order to handle __float128 types. A test has also been added to ensure that this type generates appropriate CTF information. gcc/ChangeLog: * dwarf2ctf.cc (gen_ctf_base_type): encode CTF_FP_LDOUBLE if bit_size == 128. gcc/testsuite/ChangeLog: * gcc.dg/debug/ctf/ctf-float128.c: New test. Signed-off-by: Bruce McCulloch <bruce.mccull...@oracle.com> --- gcc/dwarf2ctf.cc | 2 +- gcc/testsuite/gcc.dg/debug/ctf/ctf-float128.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float128.c diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index 7de3696a4d7..fd326b320af 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -262,7 +262,7 @@ gen_ctf_base_type (ctf_container_ref ctfc, dw_die_ref type) ctf_encoding.cte_format = CTF_FP_SINGLE; else if (bit_size == double_bit_size) ctf_encoding.cte_format = CTF_FP_DOUBLE; - else if (bit_size == long_double_bit_size) + else if ((bit_size == long_double_bit_size) || (bit_size == 128)) ctf_encoding.cte_format = CTF_FP_LDOUBLE; else /* CTF does not have representation for other types. Skip them. */ diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-float128.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float128.c new file mode 100644 index 00000000000..50240d2d6cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float128.c @@ -0,0 +1,11 @@ +/* Tests for CTF __float128 type. + - Verify that there is a long double record. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-additional-options "-m32" { target { i?86-*-* x86_64-*-* } } }*/ +/* { dg-require-effective-target __float128 } */ +/* { dg-final { scan-assembler-times ".long\[ \t\]+0xa000000\[ \t\]+\[^\n\]*# ctt_info" 1} } */ +/* { dg-final { scan-assembler-times "ascii \"_Float128.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +__float128 a = 100; -- 2.43.5