[Bug c++/41201] New: #pragma GCC target ("sse2") doesn't alter __SSE2__ in C++ (as it does in C)
dbaron at dbaron dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 31 20:19:00 GMT 2009
I'm really not sure what component this goes in; apologies if it's wrong.
The following testcase:
=== BEGIN pragma.c ===
#ifdef __SSE2__
#error "SSE2 should not be defined"
#endif
#pragma GCC push_options
#pragma GCC target ("sse2")
#ifndef __SSE2__
#error "SSE2 should be defined"
#endif
#pragma GCC pop_options
#ifdef __SSE2__
#error "SSE2 should not be defined"
#endif
=== END pragma.c ===
hits the middle #error in C++, but compiles correctly in C. I'm using GCC
4.4.1 with -mno-sse2:
$ /usr/local/gcc-4.4.1/bin/gcc -x c -c -mno-sse2 pragma.c
[returns 0]
$ /usr/local/gcc-4.4.1/bin/gcc -x c++ -c -mno-sse2 pragma.c
pragma.c:10:2: error: #error "SSE2 should be defined"
[returns 1]
This matters because the real case I'm worried about (for
https://bugzilla.mozilla.org/show_bug.cgi?id=513422 ) is an example that
replaces the middle #ifdef-#error-#endif in the testcase with a #include of
<emmintrin.h>, and emmintrin.h has an #error in exactly that case.
I think C++ should behave the same as C does (a behavior that it looks like a
number of C testcases already in the GCC testsuite depend on: sse-22.c sse-23.c
funcspec-9.c in gcc/testsuite/gcc.target/i386)
--
Summary: #pragma GCC target ("sse2") doesn't alter __SSE2__ in
C++ (as it does in C)
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dbaron at dbaron dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41201
More information about the Gcc-bugs
mailing list