public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++-v3: testsuite: complex proj requirements
@ 2022-06-21  5:39 Alexandre Oliva
  2022-06-27 10:08 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-21  5:39 UTC (permalink / raw)
  To: gcc-patches, libstdc++


The template version of complex::proj returns its argument without
testing for infinities, and that's all we have when neither C99
complex nor C99 math functions are available, and it seems too hard to
do better without isinf and copysign.

I suppose just calling them and expecting users will supply
specializations as needed has been ruled out, and so has refraining
from defining it when it can't be implemented correctly.

It's pointless to run the proj.cc test under these circumstances, so
arrange for it to be skipped.  In an unusual way, after trying to
introduce dg-require tests for ccomplex-or-cmath, and found their
results to be misleading due to variations across -std=* versions.

Regstrapped on x86_64-linux-gnu, also tested with a cross to
aarch64-rtems6.  Ok to install?


for  libstdc++-v3/ChangeLog

	* testsuite/26_numerics/complex/proj.cc: Skip test in the
	circumstances in which the implementation of proj is known to
	be broken.
---
 libstdc++-v3/testsuite/26_numerics/complex/proj.cc |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc
index a053119197ccd..69f8153c06f05 100644
--- a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc
+++ b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc
@@ -397,6 +397,19 @@ test03()
 int
 main()
 {
+  /* If neither of these macros is nonzero, proj calls a
+     specialization of the __complex_proj template, that just returns
+     its argument, without testing for infinities, rendering the whole
+     test pointless, and failing (as intended/noted in the
+     implementation) the cases that involve infinities.  Alas, the
+     normal ways to skip tests may not work: we don't have a test for
+     C99_COMPLEX, and these macros may vary depending on -std=*, but
+     macro tests wouldn't take them into account.  */
+#if ! (_GLIBCXX_USE_C99_COMPLEX || _GLIBCXX_USE_C99_MATH_TR1)
+  if (true)
+    return 0;
+#endif
+
   test01();
   test02();
   test03();

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++-v3: testsuite: complex proj requirements
  2022-06-21  5:39 [PATCH] libstdc++-v3: testsuite: complex proj requirements Alexandre Oliva
@ 2022-06-27 10:08 ` Alexandre Oliva
  2022-06-27 10:12   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-27 10:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++

On Jun 21, 2022, Alexandre Oliva <oliva@adacore.com> wrote:

> 	* testsuite/26_numerics/complex/proj.cc: Skip test in the
> 	circumstances in which the implementation of proj is known to
> 	be broken.

Ping?

https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596922.html

(I've dropped the '-v3' from the summary line after noticing it)

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++-v3: testsuite: complex proj requirements
  2022-06-27 10:08 ` Alexandre Oliva
@ 2022-06-27 10:12   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2022-06-27 10:12 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, libstdc++

On Mon, 27 Jun 2022 at 11:09, Alexandre Oliva via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On Jun 21, 2022, Alexandre Oliva <oliva@adacore.com> wrote:
>
> >       * testsuite/26_numerics/complex/proj.cc: Skip test in the
> >       circumstances in which the implementation of proj is known to
> >       be broken.
>
> Ping?
>
> https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596922.html
>
> (I've dropped the '-v3' from the summary line after noticing it)

OK


>
> --
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>    Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-27 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21  5:39 [PATCH] libstdc++-v3: testsuite: complex proj requirements Alexandre Oliva
2022-06-27 10:08 ` Alexandre Oliva
2022-06-27 10:12   ` Jonathan Wakely

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).