[Bug target/51654] C++ preprocessor bug with -maltivec and typedefs involving 'vector'
win_wa at gmx dot net
gcc-bugzilla@gcc.gnu.org
Thu Jun 20 14:36:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51654
Mathias Winkel <win_wa at gmx dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |win_wa at gmx dot net
--- Comment #6 from Mathias Winkel <win_wa at gmx dot net> ---
Unfortunately, the way the altivec extensions are defined still poses some
issues when using the latest GNU C Preprocessor. The configure flags for my GCC
are given below.
We are using the cpp to preprocess some of our Fortran code that makes heavy
use of variadic parameter macros etc.
In one of our source files, there is a Fortran comment "! Separation vector".
Here, the cpp recognizes 'vector' as a predefined macro (apparently with
missing parameters, compare
http://gcc.gnu.org/onlinedocs/gcc/PowerPC-AltiVec_002fVSX-Built_002din-Functions.html)
and inserts a number of empty lines that prevent to Fortran code from being
compileable.
A reduced test example is:
XXX@juqueen1:~/gcc-test/pepc $ cat testbla
! separation vector
// separation vector
! separation vector int a
// separation vector int a
XXX@juqueen1:~/gcc-test/pepc $ cpp -P -C testbla
! separation
vector
// separation vector
! separation vector int a
// separation vector int a
Interestingly, nothing happens for 'vector int a', i.e. with trailing arguments
or in C++ comments.
One solution is to explicitly undefine 'vector':
XXX@juqueen1:~/gcc-test/pepc $ cpp -P -C -Uvector testbla
! separation vector
// separation vector
! separation vector int a
// separation vector int a
However, it would be more desireable of the code was just left unchanged of the
'vector ...' pattern is not matched or if it is found behind the exclamation
mark that introduces Fortran comments.
======
GCC configure options:
XXX@juqueen1:~/gcc-test $ cpp -v
Using built-in specs.
COLLECT_GCC=cpp
Target: powerpc64-bgq-linux
Configured with: ../gcc_source/configure --disable-bootstrap
--prefix=/bgsys/local/gcc/4.9 --program-suffix= --program-prefix= --enable-lto
--disable-checking --enable-shared --enable-threads=posix
--target=powerpc64-bgq-linux --host=powerpc64-linux-gnu
--build=powerpc64-linux-gnu --enable-secureplt --disable-libmudflap
--disable-libspp --enable-languages=c,c++,fortran,lto --disable-multilib
--with-long-double-128
--with-headers=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//sys-include
--with-libs=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//lib
--with-bin=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//bin
--with-sbin=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//sbin :
(reconfigured) ../gcc_source/configure --disable-bootstrap
--prefix=/bgsys/local/gcc/4.9 --program-suffix= --program-prefix= --enable-lto
--disable-checking --enable-shared --enable-threads=posix
--target=powerpc64-bgq-linux --host=powerpc64-linux-gnu
--build=powerpc64-linux-gnu --enable-secureplt --disable-libmudflap
--disable-libspp --enable-languages=c,c++,fortran,lto --disable-multilib
--with-long-double-128
--with-headers=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//sys-include
--with-libs=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//lib
--with-bin=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//bin
--with-sbin=/bgsys/drivers/ppcfloor//gnu-linux/powerpc64-bgq-linux//sbin
Thread model: posix
gcc version 4.9.0 20130620 (experimental) (GCC)
More information about the Gcc-bugs
mailing list