Patchwork [libgfortran] PR 47830 Fix building on NetBSD

login
register
mail settings
Submitter Tobias Burnus
Date Feb. 22, 2011, 10:18 a.m.
Message ID <20110222101821.GA5474@physik.fu-berlin.de>
Download mbox | patch
Permalink /patch/83946/
State New
Headers show

Comments

Tobias Burnus - Feb. 22, 2011, 10:18 a.m.
Seemingly, no one tried to compile libgfortran on
a system which didn't support roundl but had
nextafterl. That has changed: NetBSD is such a
system and, thus, compiling failed (cf. PR).

Solution: Remove the "static" and add a "t" to
"nex(t)afterl".

OK for the trunk? How far back to we want to go?
I was thinking of patching 4.4 and 4.5.

Tobias
Janne Blomqvist - Feb. 22, 2011, 11:23 a.m.
On Tue, Feb 22, 2011 at 12:18, Tobias Burnus
<tobias.burnus@physik.fu-berlin.de> wrote:
> Seemingly, no one tried to compile libgfortran on
> a system which didn't support roundl but had
> nextafterl. That has changed: NetBSD is such a
> system and, thus, compiling failed (cf. PR).
>
> Solution: Remove the "static" and add a "t" to
> "nex(t)afterl".
>
> OK for the trunk?

Ok.

> How far back to we want to go?
> I was thinking of patching 4.4 and 4.5.

This patch is so trivial and obvious, that I don't see any risk in
backporting. So I leave it up to you to decide how far back you have
energy to go. :)

Patch

2011-02-22  Tobias Burnus  <burnus@net-b.de>
	    Kai-Uwe Eckhardt  <kuehro@gmx.de>

	PR libfortran/47830
	* intrinsics/c99_functions.c (roundl): Make C valid for
	HAVE_NEXTAFTERL.

diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c
index 8a9c2f1..9ba5544 100644
--- a/libgfortran/intrinsics/c99_functions.c
+++ b/libgfortran/intrinsics/c99_functions.c
@@ -600,7 +600,7 @@  roundl (long double x)
   if (x > DBL_MAX || x < -DBL_MAX)
     {
 #ifdef HAVE_NEXTAFTERL
-      static long double prechalf = nexafterl (0.5L, LDBL_MAX);
+      long double prechalf = nextafterl (0.5L, LDBL_MAX);
 #else
       static long double prechalf = 0.5L;
 #endif