public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH, Fortran] Skip gfortran.dg/PR100914.f90 on targets that don't provide quadmath.h
Date: Sat, 4 Sep 2021 20:30:58 -0600	[thread overview]
Message-ID: <afff7f97-8a7f-9add-cacd-4afaa6392ded@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

The testcase gfortran.dg/PR100914.f90 that I recently checked in 
(originally written by José Rui Faustino de Sousa) depends on the 
<quadmath.h> header file to obtain a typedef for __complex128.  It 
appears not to be possible to define an equivalent type in a portable 
way in the testcase itself (see 
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Floating-Types.html) so 
this patch skips the test entirely on targets where quadmath.h is not 
available.

The target-supports.exp change was cut-and-pasted from similar code in 
that file, but I haven't figured out how to test this change in a build 
that doesn't provide quadmath.h (e.g., my aarch64-linux-gnu toolchain 
build attempt croaked with an unrelated compilation error in glibc). 
Perhaps someone who previously encountered the FAILs on this testcase 
can confirm that it's skipped with this change?

-Sandra

[-- Attachment #2: pr100914.patch --]
[-- Type: text/x-patch, Size: 1891 bytes --]

commit 41fe3b50b3d92931fc99ef15f86cc9299e0c617e
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Sat Sep 4 18:36:39 2021 -0700

    Skip gfortran.dg/PR100914.f90 on targets that don't provide quadmath.h.
    
    This test uses the __complex128 type, which is provided by the
    <quadmath.h> header which may not be available on all targets.
    
    2021-09-04  Sandra Loosemore  <sandra@codesourcery.com>
    
    gcc/testsuite/
    
    	* lib/target-supports.exp (check_effective_target_quadmath_h):
    	New function.
    	* gfortran.dg/PR100914.f90: Use it.  Add comments.

diff --git a/gcc/testsuite/gfortran.dg/PR100914.f90 b/gcc/testsuite/gfortran.dg/PR100914.f90
index 64b3335..aff405a 100644
--- a/gcc/testsuite/gfortran.dg/PR100914.f90
+++ b/gcc/testsuite/gfortran.dg/PR100914.f90
@@ -1,7 +1,10 @@
 ! Fails on x86 targets where sizeof(long double) == 16.
 ! { dg-do run { xfail { { x86_64*-*-* i?86*-*-* } && longdouble128 } } }
-! { dg-additional-sources PR100914.c }
+! Requires Fortran support for __float128.
 ! { dg-require-effective-target fortran_real_c_float128 }
+! Requires __complex128 type from quadmath.h.
+! { dg-require-effective-target quadmath_h }
+! { dg-additional-sources PR100914.c }
 !
 ! Test the fix for PR100914
 ! 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ad8f011..072b776 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8340,6 +8340,14 @@ proc check_effective_target_libc_has_complex_functions {} {
     }]
 }
 
+# Return true if this target has the quadmath.h header.
+
+proc check_effective_target_quadmath_h {} {
+    return [check_no_compiler_messages quadmath_h object {
+ #include <quadmath.h>
+    }]
+}
+
 # Return 1 if
 #   (a) an error of a few ULP is expected in string to floating-point
 #       conversion functions; and

             reply	other threads:[~2021-09-05  2:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  2:30 Sandra Loosemore [this message]
2021-09-05 13:31 ` H.J. Lu
2021-09-05 18:02   ` Sandra Loosemore
2021-09-06  1:29     ` H.J. Lu
2021-09-06  5:20       ` Sandra Loosemore
2021-09-06  7:06         ` Christophe Lyon
2021-09-06 10:18         ` Tobias Burnus
2021-09-06 16:31         ` Joseph Myers
2021-09-17  4:02         ` [PATCH, Fortran] Use _Float128 rather than __float128 for c_float128 kind Sandra Loosemore
2021-09-17  8:27           ` Tobias Burnus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afff7f97-8a7f-9add-cacd-4afaa6392ded@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).