https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104194

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:866d73019bd4d1804f7e09409322e6605b81780b

commit r12-6882-g866d73019bd4d1804f7e09409322e6605b81780b
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Jan 26 19:42:31 2022 +0100

    dwarf2out: For ppc64le IEEE quad long double, emit DW_TAG_typedef to
_Float128 [PR104194]

    On Mon, Jan 24, 2022 at 11:26:27PM +0100, Jakub Jelinek via Gcc-patches
wrote:
    > Yet another short term solution might be not use DW_TAG_base_type
    > for the IEEE quad long double, but instead pretend it is a DW_TAG_typedef
    > with DW_AT_name "long double" to __float128 DW_TAG_base_type.
    > I bet gdb would even handle it without any changes, but of course, it
would
    > be larger than the other proposed changes.

    Here it is implemented.

    Testcases I've played with are e.g.:
    __ibm128 a;
    long double b;
    _Complex long double c;

    static __attribute__((noinline)) int
    foo (long double d)
    {
      long double e = d + 1.0L;
      return 0;
    }

    int
    main ()
    {
      a = 1.0;
      b = 2.0;
      c = 5.0 + 6.0i;
      return foo (7.0L);
    }
    and
      real(kind=16) :: a
      complex(kind=16) :: b
      a = 1.0
      b = 2.0
    end

    Printing the values of the variables works well,
    p &b or p &c shows pointer to the correct type, just
    ptype b or ptype c prints _Float128 instead of
    long double or complex _Float128 instead of complex long double.
    Even worse in fortran where obviously _Float128 or
    complex _Float128 aren't valid types, but as GDB knows them by name,
    it is just ptype that is weird.

    2022-01-26  Jakub Jelinek  <ja...@redhat.com>

            PR debug/104194
            * dwarf2out.cc (long_double_as_float128): New function.
            (modified_type_die): For powerpc64le IEEE 754 quad long double
            and complex long double emit those as DW_TAG_typedef to
            _Float128 or complex _Float128 base type.

Reply via email to