diff mbox

Fix libquadmath regression (bootstrap failure) on FreeBSD

Message ID alpine.LSU.2.21.1707192012420.5621@anthias.pfeifer.com
State New
Headers show

Commit Message

Gerald Pfeifer July 19, 2017, 7:35 p.m. UTC
Hi Jakub, 

  r250343 | jakub | 2017-07-19 13:12:58 +0000 (Wed, 19 Jul 2017) | 48 lines

        PR libquadmath/65757
        * quadmath-imp.h (math_opt_barrier, math_force_eval,
        math_narrow_eval, math_check_force_underflow,
        math_check_force_underflow_nonneg): Define.
        * math/ceilq.c: Backport changes from upstream glibc
        between 2012-11-01 and 2017-07-13.

is causing this 

  /scratch/tmp/gerald/GCC-HEAD/libquadmath/math/powq.c: In function 'powq':
  /scratch/tmp/gerald/GCC-HEAD/libquadmath/math/powq.c:266:11: error: 'u_int32_t'
  undeclared (first use in this function); did you mean 'uint32_t'?
   if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
           ^~~~~~~~~
           uint32_t

on my "nightly" FreeBSD 10/i386 tester (and I could not find a mail
on gcc-patches referring to this commit).

This fixes it.  Okay to apply to GCC?  And can you please push this
to glibc as well (which I do not have access to)?

Gerald


2017-07-19  Gerald Pfeifer  <gerald@pfeifer.com>

	* math/powq.c (powq): Use uint32_t instead of u_int32_t.

Comments

Jakub Jelinek July 19, 2017, 7:40 p.m. UTC | #1
On Wed, Jul 19, 2017 at 09:35:36PM +0200, Gerald Pfeifer wrote:
> Hi Jakub, 
> 
>   r250343 | jakub | 2017-07-19 13:12:58 +0000 (Wed, 19 Jul 2017) | 48 lines
> 
>         PR libquadmath/65757
>         * quadmath-imp.h (math_opt_barrier, math_force_eval,
>         math_narrow_eval, math_check_force_underflow,
>         math_check_force_underflow_nonneg): Define.
>         * math/ceilq.c: Backport changes from upstream glibc
>         between 2012-11-01 and 2017-07-13.
> 
> is causing this 
> 
>   /scratch/tmp/gerald/GCC-HEAD/libquadmath/math/powq.c: In function 'powq':
>   /scratch/tmp/gerald/GCC-HEAD/libquadmath/math/powq.c:266:11: error: 'u_int32_t'
>   undeclared (first use in this function); did you mean 'uint32_t'?
>    if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
>            ^~~~~~~~~
>            uint32_t
> 
> on my "nightly" FreeBSD 10/i386 tester (and I could not find a mail
> on gcc-patches referring to this commit).
> 
> This fixes it.  Okay to apply to GCC?

Ok, thanks.

>  And can you please push this
> to glibc as well (which I do not have access to)?

glibc uses u_int32_t in all the places of *powl.c where libquadmath
uses uint32_t, and various other files, so I guess it is intentional.

	Jakub
Gerald Pfeifer July 19, 2017, 8:15 p.m. UTC | #2
On Wed, 19 Jul 2017, Jakub Jelinek wrote:
>> This fixes it.  Okay to apply to GCC?
> Ok, thanks.

Thanks for the quick response, Jakub!

> glibc uses u_int32_t in all the places of *powl.c where libquadmath
> uses uint32_t, and various other files, so I guess it is intentional.

Ah, I see.  I guess we just need to keep an eye on this, then, as
merges happen.

Gerald
Joseph Myers July 31, 2017, 5:53 p.m. UTC | #3
On Wed, 19 Jul 2017, Jakub Jelinek wrote:

> >  And can you please push this
> > to glibc as well (which I do not have access to)?
> 
> glibc uses u_int32_t in all the places of *powl.c where libquadmath
> uses uint32_t, and various other files, so I guess it is intentional.

I'd consider it a relic of old fdlibm code, i.e. code (all over libm) that 
hasn't yet been cleaned up to use uintN_t instead of u_intN_t internally 
(but which it would be desirable to clean up like that).

I think it would be desirable to be able to do libquadmath imports via a 
script that automatically applies substitutions to turn glibc code into 
code that can be used in libquadmath.  Right now required substitutions 
would include s/u_int/uint/, and converting L() to apply appropriate 
suffixes, and converting function calls to the *q form, while some other 
substitutions such as s/_Float128/__float128/ would not actually be needed 
for the code to build but would make the results of substitution closer to 
the present libquadmath contents, and so easier to compare.  If then the 
number of substitutions needed can be reduced over time (e.g. defining L() 
as a macro in quadmath-imp.h rather than substituting it in the sources), 
that would be good.  Moving glibc code (across libm, not just ldbl-128) to 
use uintN_t would be in that category.
diff mbox

Patch

Index: math/powq.c
===================================================================
--- math/powq.c	(revision 250360)
+++ math/powq.c	(working copy)
@@ -263,7 +263,7 @@ 
 
   /* sgn (sign of result -ve**odd) = -1 else = 1 */
   sgn = one;
-  if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
+  if (((((uint32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
     sgn = -one;				/* (-ve)**(odd int) */
 
   /* |y| is huge.