Bug 95180

Summary: rasterizer/memory/Convert.h:170:9: error: ‘__builtin_isnan’ is not a member of ‘std’
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium Keywords: regression
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-04-28 05:55:32 UTC
mesa: 32cb7d61a908c519641959158de0a44fd2c8a6e7 (master 11.3.0-devel)

  CXX      rasterizer/memory/libswrAVX_la-ClearTile.lo
In file included from rasterizer/memory/ClearTile.cpp:34:0:
./rasterizer/memory/Convert.h: In function ‘uint16_t Convert32To16Float(float)’:
./rasterizer/memory/Convert.h:170:9: error: ‘__builtin_isnan’ is not a member of ‘std’
     if (std::isnan(val))
         ^
./rasterizer/memory/Convert.h:170:9: note: suggested alternative:
<built-in>: note:   ‘__builtin_isnan’
Comment 1 Tim Rowley 2016-04-28 11:10:30 UTC
That's odd - "std:isnan" is C++11, and I don't see any macros in the mesa tree that would be messing it up.  What compiler/platform are you building on?
Comment 2 Jose Fonseca 2016-04-28 11:30:26 UTC
I wonder if there's a

  #include <cmath>

missing somewhere.

Also, per https://cgit.freedesktop.org/mesa/mesa/commit/?id=649704f1f7c9e1d0990d34a76154b2eb656bee42 , it sounds that GLIBC prior to 2.23 does not have isnan in std namespace.  That might be the problem.


The easiest way to check GLIBC version is `ldd --version`
Comment 3 Ilia Mirkin 2016-04-28 14:41:49 UTC
From the sounds of it, there's a

#define isnan __builtin_isnan

somewhere which is converting

std::isnan

into

std::__builtin_isnan
Comment 4 Vinson Lee 2016-04-30 01:26:00 UTC
I am building with GCC 5.3 on Ubuntu 16.10.

$ gcc --version
gcc (Ubuntu 5.3.1-16ubuntu2) 5.3.1 20160424
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu3) 2.23
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
Comment 5 Vinson Lee 2016-05-27 04:10:27 UTC
commit 8d639138c712c5bbe0b9ea8adbc810b23a2e8d1b
Author: Vinson Lee <vlee@freedesktop.org>
Date:   Mon May 9 16:02:12 2016 -0700

    swr: [rasterizer] Include cmath for std::isnan and std::isinf.
    
    This patch fixes this build error.
    
      CXX      rasterizer/memory/libswrAVX_la-ClearTile.lo
    In file included from rasterizer/memory/ClearTile.cpp:34:0:
    ./rasterizer/memory/Convert.h: In function ‘uint16_t Convert32To16Float(float)’:
    ./rasterizer/memory/Convert.h:170:9: error: ‘__builtin_isnan’ is not a member of ‘std’
         if (std::isnan(val))
             ^
    ./rasterizer/memory/Convert.h:170:9: note: suggested alternative:
    <built-in>: note:   ‘__builtin_isnan’
    ./rasterizer/memory/Convert.h:176:14: error: ‘__builtin_isinf_sign’ is not a member of ‘std’
         else if (std::isinf(val))
                  ^
    ./rasterizer/memory/Convert.h:176:14: note: suggested alternative:
    <built-in>: note:   ‘__builtin_isinf_sign’
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95180
    Signed-off-by: Vinson Lee <vlee@freedesktop.org>
    Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
    Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.