public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Maciej W. Rozycki <macro@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-5450] libgfortran: Correct FP feature macro checks Date: Thu, 26 Nov 2020 17:27:52 +0000 (GMT) [thread overview] Message-ID: <20201126172752.993493857034@sourceware.org> (raw) https://gcc.gnu.org/g:c87cce5a339bae3b73f34dbc20409de07caf68da commit r11-5450-gc87cce5a339bae3b73f34dbc20409de07caf68da Author: Maciej W. Rozycki <macro@linux-mips.org> Date: Thu Nov 26 17:26:43 2020 +0000 libgfortran: Correct FP feature macro checks The *_HAS_* floating-point feature macros are defined as 0/1 rather than #undef/#define settings by gcc/c-family/c-cppbuiltin.c. Consequently we choose to use infinity and NaN features even with non-IEEE-754 targets such as `vax-netbsdelf' that lack them, causing build warnings and failures like: In file included from .../libgfortran/generated/maxval_r4.c:26: .../libgfortran/generated/maxval_r4.c: In function 'maxval_r4': .../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity 292 | # define GFC_REAL_4_INFINITY __builtin_inff () | ^~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c:149:19: note: in expansion of macro 'GFC_REAL_4_INFINITY' 149 | result = -GFC_REAL_4_INFINITY; | ^~~~~~~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c: In function 'mmaxval_r4': .../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity 292 | # define GFC_REAL_4_INFINITY __builtin_inff () | ^~~~~~~~~~~~~~ .../libgfortran/generated/maxval_r4.c:363:19: note: in expansion of macro 'GFC_REAL_4_INFINITY' 363 | result = -GFC_REAL_4_INFINITY; | ^~~~~~~~~~~~~~~~~~~ {standard input}: Assembler messages: {standard input}:204: Fatal error: Can't relocate expression make[3]: *** [Makefile:3358: maxval_r4.lo] Error 1 Correct the checks then for __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__, __LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__ to match semantics and remove build issues coming from the misinterpretation of these macros. libgfortran/ * libgfortran.h: Use #if rather than #ifdef with __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__, __LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__. Diff: --- libgfortran/libgfortran.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 8c539e0898b..e9c54810f42 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -288,13 +288,13 @@ typedef GFC_UINTEGER_4 gfc_char4_t; /* M{IN,AX}{LOC,VAL} need also infinities and NaNs if supported. */ -#ifdef __FLT_HAS_INFINITY__ +#if __FLT_HAS_INFINITY__ # define GFC_REAL_4_INFINITY __builtin_inff () #endif -#ifdef __DBL_HAS_INFINITY__ +#if __DBL_HAS_INFINITY__ # define GFC_REAL_8_INFINITY __builtin_inf () #endif -#ifdef __LDBL_HAS_INFINITY__ +#if __LDBL_HAS_INFINITY__ # ifdef HAVE_GFC_REAL_10 # define GFC_REAL_10_INFINITY __builtin_infl () # endif @@ -306,13 +306,13 @@ typedef GFC_UINTEGER_4 gfc_char4_t; # endif # endif #endif -#ifdef __FLT_HAS_QUIET_NAN__ +#if __FLT_HAS_QUIET_NAN__ # define GFC_REAL_4_QUIET_NAN __builtin_nanf ("") #endif -#ifdef __DBL_HAS_QUIET_NAN__ +#if __DBL_HAS_QUIET_NAN__ # define GFC_REAL_8_QUIET_NAN __builtin_nan ("") #endif -#ifdef __LDBL_HAS_QUIET_NAN__ +#if __LDBL_HAS_QUIET_NAN__ # ifdef HAVE_GFC_REAL_10 # define GFC_REAL_10_QUIET_NAN __builtin_nanl ("") # endif
reply other threads:[~2020-11-26 17:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201126172752.993493857034@sourceware.org \ --to=macro@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).