Bug 68504 - 9.2-rc1 workaround for clover build failure on ppc/altivec: cannot convert 'bool' to '__vector(4) __bool int' in return
Summary: 9.2-rc1 workaround for clover build failure on ppc/altivec: cannot convert 'b...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 9.2
Hardware: Other All
: medium normal
Assignee: Matt Turner
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
: 93687 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-24 12:15 UTC by Chí-Thanh Christopher Nguyễn
Modified: 2017-03-07 10:31 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
compressed build.log (43.95 KB, application/x-xz)
2013-08-24 12:15 UTC, Chí-Thanh Christopher Nguyễn
Details

Description Chí-Thanh Christopher Nguyễn 2013-08-24 12:15:21 UTC
Created attachment 84560 [details]
compressed build.log

Using gcc-4.7.3, llvm-3.3, clang-3.3 on Gentoo PPC

./configure --prefix=/usr --build=powerpc-unknown-linux-gnu --host=powerpc-unknown-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-silent-rules --disable-dependency-tracking --enable-dri --enable-glx --enable-shared-glapi --enable-texture-float --disable-debug --enable-egl --disable-gbm --disable-gles1 --disable-gles2 --enable-glx-tls --disable-osmesa --enable-asm --disable-xa --disable-xorg --with-dri-drivers=,swrast,radeon,r200 --with-gallium-drivers=,swrast,r300,r600 PYTHON2=/usr/bin/python2.7 --with-egl-platforms=x11 --enable-gallium-egl --enable-gallium-llvm --disable-openvg --enable-r600-llvm-compiler --disable-vdpau --disable-xvmc --enable-opencl --with-opencl-libdir=/usr/lib/OpenCL/vendors/mesa --with-clang-libdir=/usr/lib

Causes the build to fail in clover:

In file included from ./core/device.hpp:29:0,
                 from core/device.cpp:23:
./core/base.hpp: In member function '__vector(4) __bool int clover::ref_counter::release()':
./core/base.hpp:73:36: error: cannot convert 'bool' to '__vector(4) __bool int' in return
./core/base.hpp: At global scope:
./core/base.hpp:205:26: error: expected type-specifier
./core/base.hpp:205:26: error: expected '>'
Comment 1 Francisco Jerez 2013-08-24 18:19:28 UTC
bugzilla-daemon@freedesktop.org writes:

> Using gcc-4.7.3, llvm-3.3, clang-3.3 on Gentoo PPC
>
>[...]
> Causes the build to fail in clover:
>
> In file included from ./core/device.hpp:29:0,
>                  from core/device.cpp:23:
> ./core/base.hpp: In member function '__vector(4) __bool int
> clover::ref_counter::release()':
> ./core/base.hpp:73:36: error: cannot convert 'bool' to '__vector(4) __bool int'
> in return

That's weird...  It looks like gcc is trying to vectorize the return
type of that function, unsuccessfully.  Can you try with different build
flags like "-mcpu=powerpc" instead of "-mcpu=7450" and/or
"-fno-tree-vectorize"?

>[...]
Comment 2 Chí-Thanh Christopher Nguyễn 2013-08-25 17:13:05 UTC
Tried to build 9.2-rc2 with different compiler flags:

CXXFLAGS="-O2 -mcpu=7450 -fno-free-vectorize" fails
CXXFLAGS="-O2 -mcpu=powerpc" succeeds
CXXFLAGS="-O2 -mcpu=7450 -mno-altivec" succeeds

So it looks like the altivec vectorization triggers this issue.
Comment 3 Chí-Thanh Christopher Nguyễn 2013-08-25 20:50:34 UTC
It appears that inclusion of altivec.h in cl_platform.h causes "bool" to be redefined to "__attribute__((altivec(bool__))) unsigned", but only with -std=c++XY

Not including altivec.h or using -std=gnu++11 makes the error go away.
Comment 4 Francisco Jerez 2013-08-25 21:33:24 UTC
(In reply to comment #3)
> It appears that inclusion of altivec.h in cl_platform.h causes "bool" to be
> redefined to "__attribute__((altivec(bool__))) unsigned", but only with
> -std=c++XY
> 
> Not including altivec.h or using -std=gnu++11 makes the error go away.

Uhm, that shouldn't happen...  Can you please file a GCC bug about this?  A compiler optimization shouldn't break code that is otherwise correct and working...

Thank you.
Comment 5 Chí-Thanh Christopher Nguyễn 2013-08-25 21:36:19 UTC
Upstream closed my bug report (linked under See Also:) as invalid with the following response:
"You need to use -std=g++11 or undefine bool after the include of altivec.h as
context sensitive keywords is not part of the C++11 standard."
Comment 6 Chí-Thanh Christopher Nguyễn 2013-08-26 21:54:17 UTC
Patch with workaround sent: http://lists.freedesktop.org/archives/mesa-dev/2013-August/043890.html

Tested to build successfully on Gentoo PPC.
Comment 7 Matt Turner 2017-03-02 05:59:43 UTC
New patch sent.

https://lists.freedesktop.org/archives/mesa-dev/2017-March/146322.html
Comment 8 Matt Turner 2017-03-02 23:49:46 UTC
Patch is now upstream.

commit 7d1195c1e4d071fe796bf5f210c468ea1cc86225
Author: Matt Turner <mattst88@gmail.com>
Date:   Thu Mar 2 04:43:21 2017 +0000

    clover: Work around build failure with AltiVec.
Comment 9 Andreas Boll 2017-03-07 10:31:32 UTC
*** Bug 93687 has been marked as a duplicate of this bug. ***


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.