* [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp @ 2022-07-13 19:38 Carl Love 2022-07-15 11:42 ` Ulrich Weigand 2022-07-18 15:22 ` Pedro Alves 0 siblings, 2 replies; 5+ messages in thread From: Carl Love @ 2022-07-13 19:38 UTC (permalink / raw) To: gdb-patches, Will Schmidt, Ulrich Weigand, cel GDB maintainers: GCC 12 on Power now sets the IEEE 128-bit floating point format as the default format for 128-bit floating point numbers. Previously the default was the IBM long double format. The change resulted in a number of test failures as the type is now printed as __Float128 not long double. This patch updates the expected results to look for the new printed values on GCC 12 and beyond while still looking for the previous value on older versions of GCC. The patch has been tested on Power with GCC 12 and 4.85 as well as X86 with GCC version 11.2. Please let me know if this patch is acceptable for mainline. Thanks. Carl Love ------------------------------------------------------- Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp The test fails with the following errors on PowerPC using gcc version 12.1: ... ptype long_double_typedef type = _Float128 (gdb) FAIL: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: ptype long_double_typedef whatis long_double_typedef2 type = long_double_typedef (gdb) PASS: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: whatis long_double_typedef2 ptype long_double_typedef2 type = _Float128 (gdb) FAIL: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: ptype long_double_typedef2 whatis v_long_double_typedef type = long_double_typedef (gdb) PASS: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: whatis v_long_double_typedef ptype v_long_double_typedef type = _Float128^M (gdb) FAIL: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: ptype v_long_double_typedef whatis v_long_double_typedef2 type = long_double_typedef2 (gdb) PASS: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: whatis v_long_double_typedef2 ptype v_long_double_typedef2 type = _Float128^M (gdb) FAIL: gdb.base/whatis-ptype-typedefs.exp: lang=c: whatis/ptype: ptype v_long_double_typedef2 ... GCC enabled IEEE FLOAT 128-bit support starting with GCC 12 by default. Previously long double was the default for 128-bit floating point support. This patch updates the expected result for the "long doube" tests to _Float128 if GCC 12 is used. The previous "long double" result is expected for GCC 11 and older versions. The patch has been run on Power 7 (gcc version 4.8.5), Power 10 (gcc version 12.1) and Intel x86_64 (gcc version 11.2.0) to verify the patch fixes the 74 test failures on Power 10 with GCC 12 and does not introduce any regression failures on older versions of GCC. --- .../gdb.base/whatis-ptype-typedefs.exp | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp index be76183ca79..a17084a19ec 100644 --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp @@ -77,6 +77,12 @@ proc prepare {lang} { # # This can be "c" or "c++". # + +# GCC 12 uses IEEE 128-bit floating point as the default starting with GCC 12. +# The table below consists of the compiler independent tests. The GCC version +# specific tests are appended to the end of the table based on the compiler +# version. + # Columns in the table represent: # EXP # whatis # ptype # language set table { @@ -97,12 +103,6 @@ set table { {"double_typedef2" "double_typedef" "double"} {"v_double_typedef" "double_typedef" "double"} {"v_double_typedef2" "double_typedef2" "double"} - - {"long_double_typedef" "long double" "long double"} - {"long_double_typedef2" "long_double_typedef" "long double"} - {"v_long_double_typedef" "long_double_typedef" "long double"} - {"v_long_double_typedef2" "long_double_typedef2" "long double"} - {"colors_typedef" "(enum )?colors" "enum colors( : unsigned int)? {red, green, blue}"} {"colors_typedef2" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} {"v_colors_typedef" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} @@ -151,6 +151,20 @@ set table { "c++"} } +# Add the long double tests on the version of GCC +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 12 } { + lappend table {"long_double_typedef" "long double" "_Float128"} + lappend table {"long_double_typedef2" "long_double_typedef" "_Float128"} + lappend table {"v_long_double_typedef" "long_double_typedef" "_Float128"} + lappend table {"v_long_double_typedef2" "long_double_typedef2" "_Float128"} + +} else { + lappend table {"long_double_typedef" "long double" "long double"} + lappend table {"long_double_typedef2" "long_double_typedef" "long double"} + lappend table {"v_long_double_typedef" "long_double_typedef" "long double"} + lappend table {"v_long_double_typedef2" "long_double_typedef2" "long double"} +} + # The 4th column above is optional. If present, it indicates that the # line should only be tested in the specified language. This is a # helper function that checks whether LINE's language matches LANG. -- 2.36.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp 2022-07-13 19:38 [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp Carl Love @ 2022-07-15 11:42 ` Ulrich Weigand 2022-07-18 15:22 ` Pedro Alves 1 sibling, 0 replies; 5+ messages in thread From: Ulrich Weigand @ 2022-07-15 11:42 UTC (permalink / raw) To: gdb-patches, will_schmidt, cel Carl Love <cel@us.ibm.com> wrote: >+# Add the long double tests on the version of GCC >+if { [test_compiler_info gcc-*] && [gcc_major_version] >= 12 } { >+ lappend table {"long_double_typedef" "long double" "_Float128"} >+ lappend table {"long_double_typedef2" "long_double_typedef" "_Float128"} >+ lappend table {"v_long_double_typedef" "long_double_typedef" "_Float128"} >+ lappend table {"v_long_double_typedef2" "long_double_typedef2" "_Float128"} This doesn't look correct to me. First of all, we shouldn't hardcode GCC version details like that (for one, this doesn't account for any other compilers like LLVM or XLC). But also, given that "long_double_typedef" is defined via: typedef long double long_double_typedef; in the source file, I think "ptype long_double_typedef" should really always output "long double", no matter what the underlying floating-point format is. Seeing an output of "_Float128" when that type is nowhere used in the source code is weird. So I think you should investigate a bit more why we're seeing this particular output. Bye, Ulrich ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp 2022-07-13 19:38 [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp Carl Love 2022-07-15 11:42 ` Ulrich Weigand @ 2022-07-18 15:22 ` Pedro Alves 2022-07-18 15:40 ` Carl Love 1 sibling, 1 reply; 5+ messages in thread From: Pedro Alves @ 2022-07-18 15:22 UTC (permalink / raw) To: Carl Love, gdb-patches, Will Schmidt, Ulrich Weigand On 2022-07-13 8:38 p.m., Carl Love via Gdb-patches wrote: > GCC enabled IEEE FLOAT 128-bit support starting with GCC 12 by default. > Previously long double was the default for 128-bit floating point support. > This patch updates the expected result for the "long doube" tests to > _Float128 if GCC 12 is used. The previous "long double" result is > expected for GCC 11 and older versions. This whole paragraph reads as if all archs were changed, but it was just Power, right? And isn't it the case that after the change, for GCC, "long double" _IS_ IEEE FLOAT 128-bit? Doesn't that mean that GCC and GDB now have a mismatch of what they think "long double" is? Like for example, if the user copies an expression from their program and evaluates in gdb, and that expression uses "long double", then GDB will evaluate it differently from how GCC would? Shouldn't GDB instead adjust its "long double" type depending on the ABI, mapping "long double" to the right format? And then, the testcase (probably) wouldn't change? BTW, I was expecting to see GCC's default change mentioned at: https://gcc.gnu.org/gcc-12/changes.html but I can't seem to find it there, other than a Fortran reference which seems related. I did find: https://gcc.gnu.org/wiki/Ieee128PowerPC#Transition > > The patch has been run on Power 7 (gcc version 4.8.5), Power 10 (gcc > version 12.1) and Intel x86_64 (gcc version 11.2.0) to verify the patch > fixes the 74 test failures on Power 10 with GCC 12 and does not introduce > any regression failures on older versions of GCC. Seems like x86 with gcc 12 would better be tested as well. > --- > .../gdb.base/whatis-ptype-typedefs.exp | 26 ++++++++++++++----- > 1 file changed, 20 insertions(+), 6 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > index be76183ca79..a17084a19ec 100644 > --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > @@ -77,6 +77,12 @@ proc prepare {lang} { > # > # This can be "c" or "c++". > # > + > +# GCC 12 uses IEEE 128-bit floating point as the default starting with GCC 12. On all archs? > +# The table below consists of the compiler independent tests. The GCC version > +# specific tests are appended to the end of the table based on the compiler > +# version. > + > # Columns in the table represent: > # EXP # whatis # ptype # language > set table { > @@ -97,12 +103,6 @@ set table { > {"double_typedef2" "double_typedef" "double"} > {"v_double_typedef" "double_typedef" "double"} > {"v_double_typedef2" "double_typedef2" "double"} > - > - {"long_double_typedef" "long double" "long double"} > - {"long_double_typedef2" "long_double_typedef" "long double"} > - {"v_long_double_typedef" "long_double_typedef" "long double"} > - {"v_long_double_typedef2" "long_double_typedef2" "long double"} > - > {"colors_typedef" "(enum )?colors" "enum colors( : unsigned int)? {red, green, blue}"} > {"colors_typedef2" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} > {"v_colors_typedef" "colors_typedef" "enum colors( : unsigned int)? {red, green, blue}"} > @@ -151,6 +151,20 @@ set table { > "c++"} > } > > +# Add the long double tests on the version of GCC > +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 12 } { What about x86 + gcc 12 ? > + lappend table {"long_double_typedef" "long double" "_Float128"} > + lappend table {"long_double_typedef2" "long_double_typedef" "_Float128"} > + lappend table {"v_long_double_typedef" "long_double_typedef" "_Float128"} > + lappend table {"v_long_double_typedef2" "long_double_typedef2" "_Float128"} > + > +} else { > + lappend table {"long_double_typedef" "long double" "long double"} > + lappend table {"long_double_typedef2" "long_double_typedef" "long double"} > + lappend table {"v_long_double_typedef" "long_double_typedef" "long double"} > + lappend table {"v_long_double_typedef2" "long_double_typedef2" "long double"} > +} ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp 2022-07-18 15:22 ` Pedro Alves @ 2022-07-18 15:40 ` Carl Love 2022-07-18 15:55 ` Carl Love 0 siblings, 1 reply; 5+ messages in thread From: Carl Love @ 2022-07-18 15:40 UTC (permalink / raw) To: Pedro Alves, gdb-patches, Will Schmidt, Ulrich Weigand On Mon, 2022-07-18 at 16:22 +0100, Pedro Alves wrote: > On 2022-07-13 8:38 p.m., Carl Love via Gdb-patches wrote: > > > GCC enabled IEEE FLOAT 128-bit support starting with GCC 12 by > > default. > > Previously long double was the default for 128-bit floating point > > support. > > This patch updates the expected result for the "long doube" tests > > to > > _Float128 if GCC 12 is used. The previous "long double" result is > > expected for GCC 11 and older versions. > > This whole paragraph reads as if all archs were changed, but it was > just Power, right? Yes, it should say the default on PowerPC changed to IEEE. Per comments from Ulrich, I need to investigate further to figure out where the _Float128 is coming from as the string doesn't occur in the source code. From my initial look, I don't see the string in the gdb code or the test case source code, the source DWARF or objdump output. In function check_typedef (gdb/gdbtpyes.c) there is a while loop that iterates thru the type removing the typedefs. Initially the type->name = long_double_typedef but then changes to _Float128. I don't know where the typedef all gets setup but I would think it comes from reading the source code DWARF. Anyway, I am working on figuring out where and how the _Float128 gets setup. > > And isn't it the case that after the change, for GCC, "long double" > _IS_ IEEE FLOAT 128-bit? > > Doesn't that mean that GCC and GDB now have a mismatch of what they > think "long double" is? > Like for example, if the user copies an expression from their program > and evaluates in gdb, > and that expression uses "long double", then GDB will evaluate it > differently from how GCC would? > > Shouldn't GDB instead adjust its "long double" type depending on the > ABI, mapping "long double" > to the right format? And then, the testcase (probably) wouldn't > change? > > BTW, I was expecting to see GCC's default change mentioned at: > > > https://gcc.gnu.org/gcc-12/changes.html > > > but I can't seem to find it there, other than a Fortran reference > which seems related. I did find: > > > https://gcc.gnu.org/wiki/Ieee128PowerPC#Transition > > > > The patch has been run on Power 7 (gcc version 4.8.5), Power 10 > > (gcc > > version 12.1) and Intel x86_64 (gcc version 11.2.0) to verify the > > patch > > fixes the 74 test failures on Power 10 with GCC 12 and does not > > introduce > > any regression failures on older versions of GCC. > > Seems like x86 with gcc 12 would better be tested as well. > > > --- > > .../gdb.base/whatis-ptype-typedefs.exp | 26 ++++++++++++++- > > ---- > > 1 file changed, 20 insertions(+), 6 deletions(-) > > > > diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > index be76183ca79..a17084a19ec 100644 > > --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > @@ -77,6 +77,12 @@ proc prepare {lang} { > > # > > # This can be "c" or "c++". > > # > > + > > +# GCC 12 uses IEEE 128-bit floating point as the default starting > > with GCC 12. > > On all archs? > > > +# The table below consists of the compiler independent tests. The > > GCC version > > +# specific tests are appended to the end of the table based on the > > compiler > > +# version. > > + > > # Columns in the table represent: > > # EXP # whatis # ptype # > > language > > set table { > > @@ -97,12 +103,6 @@ set table { > > {"double_typedef2" "double_typedef" "double"} > > {"v_double_typedef" "double_typedef" "double"} > > {"v_double_typedef2" "double_typedef2" "double"} > > - > > - {"long_double_typedef" "long double" "long > > double"} > > - {"long_double_typedef2" "long_double_typedef" "long > > double"} > > - {"v_long_double_typedef" "long_double_typedef" "long > > double"} > > - {"v_long_double_typedef2" "long_double_typedef2" "long > > double"} > > - > > {"colors_typedef" "(enum )?colors" "enum colors( : > > unsigned int)? {red, green, blue}"} > > {"colors_typedef2" "colors_typedef" "enum colors( : > > unsigned int)? {red, green, blue}"} > > {"v_colors_typedef" "colors_typedef" "enum colors( : > > unsigned int)? {red, green, blue}"} > > @@ -151,6 +151,20 @@ set table { > > "c++"} > > } > > > > +# Add the long double tests on the version of GCC > > +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 12 } { > > What about x86 + gcc 12 ? > > > + lappend table {"long_double_typedef" "long > > double" "_Float128"} > > + lappend table > > {"long_double_typedef2" "long_double_typedef" "_Float128"} > > + lappend table > > {"v_long_double_typedef" "long_double_typedef" "_Float128"} > > + lappend table {"v_long_double_typedef2" > > "long_double_typedef2" "_Float128"} > > + > > +} else { > > + lappend table {"long_double_typedef" "long > > double" "long double"} > > + lappend table > > {"long_double_typedef2" "long_double_typedef" "long double"} > > + lappend table > > {"v_long_double_typedef" "long_double_typedef" "long double"} > > + lappend table {"v_long_double_typedef2" > > "long_double_typedef2" "long double"} > > +} > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp 2022-07-18 15:40 ` Carl Love @ 2022-07-18 15:55 ` Carl Love 0 siblings, 0 replies; 5+ messages in thread From: Carl Love @ 2022-07-18 15:55 UTC (permalink / raw) To: Pedro Alves, gdb-patches, Will Schmidt, Ulrich Weigand On Mon, 2022-07-18 at 08:40 -0700, Carl Love wrote: > On Mon, 2022-07-18 at 16:22 +0100, Pedro Alves wrote: > > On 2022-07-13 8:38 p.m., Carl Love via Gdb-patches wrote: > > > > > GCC enabled IEEE FLOAT 128-bit support starting with GCC 12 by > > > default. > > > Previously long double was the default for 128-bit floating point > > > support. > > > This patch updates the expected result for the "long doube" tests > > > to > > > _Float128 if GCC 12 is used. The previous "long double" result > > > is > > > expected for GCC 11 and older versions. > > > > This whole paragraph reads as if all archs were changed, but it was > > just Power, right? > > Yes, it should say the default on PowerPC changed to IEEE. > > Per comments from Ulrich, I need to investigate further to figure out > where the _Float128 is coming from as the string doesn't occur in the > source code. From my initial look, I don't see the string in the gdb > code or the test case source code, the source DWARF or objdump > output. I should qualify that, there is a string comparison in ppc_floatformat_for_type (gdb/ppc-linux-tdep.c) of name with "_Float128" which if true returns floatformats_ieee_quad. The comparison is True in the test case. So clearly GDB set the name field to _Float128 at some point. > In function check_typedef (gdb/gdbtpyes.c) there is a while loop that > iterates thru the type removing the typedefs. Initially the type- > >name > = long_double_typedef but then changes to _Float128. I don't know > where the typedef all gets setup but I would think it comes from > reading the source code DWARF. Anyway, I am working on figuring out > where and how the _Float128 gets setup. > > And isn't it the case that after the change, for GCC, "long double" > > _IS_ IEEE FLOAT 128-bit? > > > > Doesn't that mean that GCC and GDB now have a mismatch of what they > > think "long double" is? > > Like for example, if the user copies an expression from their > > program > > and evaluates in gdb, > > and that expression uses "long double", then GDB will evaluate it > > differently from how GCC would? > > > > Shouldn't GDB instead adjust its "long double" type depending on > > the > > ABI, mapping "long double" > > to the right format? And then, the testcase (probably) wouldn't > > change? > > > > BTW, I was expecting to see GCC's default change mentioned at: > > > > > > https://gcc.gnu.org/gcc-12/changes.html > > > > > > but I can't seem to find it there, other than a Fortran reference > > which seems related. I did find: > > > > > > https://gcc.gnu.org/wiki/Ieee128PowerPC#Transition > > > > > > > The patch has been run on Power 7 (gcc version 4.8.5), Power 10 > > > (gcc > > > version 12.1) and Intel x86_64 (gcc version 11.2.0) to verify the > > > patch > > > fixes the 74 test failures on Power 10 with GCC 12 and does not > > > introduce > > > any regression failures on older versions of GCC. > > > > Seems like x86 with gcc 12 would better be tested as well. > > > > > --- > > > .../gdb.base/whatis-ptype-typedefs.exp | 26 > > > ++++++++++++++- > > > ---- > > > 1 file changed, 20 insertions(+), 6 deletions(-) > > > > > > diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > > b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > > index be76183ca79..a17084a19ec 100644 > > > --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > > +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp > > > @@ -77,6 +77,12 @@ proc prepare {lang} { > > > # > > > # This can be "c" or "c++". > > > # > > > + > > > +# GCC 12 uses IEEE 128-bit floating point as the default > > > starting > > > with GCC 12. > > > > On all archs? > > > > > +# The table below consists of the compiler independent > > > tests. The > > > GCC version > > > +# specific tests are appended to the end of the table based on > > > the > > > compiler > > > +# version. > > > + > > > # Columns in the table represent: > > > # EXP # whatis # ptype # > > > language > > > set table { > > > @@ -97,12 +103,6 @@ set table { > > > {"double_typedef2" "double_typedef" "double"} > > > {"v_double_typedef" "double_typedef" "double"} > > > {"v_double_typedef2" "double_typedef2" "double"} > > > - > > > - {"long_double_typedef" "long double" "long > > > double"} > > > - {"long_double_typedef2" "long_double_typedef" "long > > > double"} > > > - {"v_long_double_typedef" "long_double_typedef" "long > > > double"} > > > - {"v_long_double_typedef2" "long_double_typedef2" "long > > > double"} > > > - > > > {"colors_typedef" "(enum )?colors" "enum colors( : > > > unsigned int)? {red, green, blue}"} > > > {"colors_typedef2" "colors_typedef" "enum colors( : > > > unsigned int)? {red, green, blue}"} > > > {"v_colors_typedef" "colors_typedef" "enum colors( : > > > unsigned int)? {red, green, blue}"} > > > @@ -151,6 +151,20 @@ set table { > > > "c++"} > > > } > > > > > > +# Add the long double tests on the version of GCC > > > +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 12 } { > > > > What about x86 + gcc 12 ? > > > > > + lappend table {"long_double_typedef" "long > > > double" "_Float128"} > > > + lappend table > > > {"long_double_typedef2" "long_double_typedef" "_Float128"} > > > + lappend table > > > {"v_long_double_typedef" "long_double_typedef" "_Float128"} > > > + lappend table {"v_long_double_typedef2" > > > "long_double_typedef2" "_Float128"} > > > + > > > +} else { > > > + lappend table {"long_double_typedef" "long > > > double" "long double"} > > > + lappend table > > > {"long_double_typedef2" "long_double_typedef" "long double"} > > > + lappend table > > > {"v_long_double_typedef" "long_double_typedef" "long double"} > > > + lappend table {"v_long_double_typedef2" > > > "long_double_typedef2" "long double"} > > > +} ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-18 15:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-13 19:38 [PATCH] Add IEEE FLOAT128 support to test gdb.base/whatis-ptype-typedefs.exp Carl Love 2022-07-15 11:42 ` Ulrich Weigand 2022-07-18 15:22 ` Pedro Alves 2022-07-18 15:40 ` Carl Love 2022-07-18 15:55 ` Carl Love
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).