[Bug c++/93557] New: __builtin_convertvector doesn't mak input as used
evan@coeus-group.com
gcc-bugzilla@gcc.gnu.org
Mon Feb 3 19:08:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93557
Bug ID: 93557
Summary: __builtin_convertvector doesn't mak input as used
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: evan@coeus-group.com
Target Milestone: ---
Created attachment 47771
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47771&action=edit
test case (pass -Wextra to enable the warnings)
I'm getting some false positives with -Wunused-but-set-parameter and
-Wunused-but-variable which I've narrowed down to __builtin_convertvector.
There is a quick test case attached, or ot godbolt at
https://godbolt.org/z/RSFLGB
It works as expected with gcc, but with g++ I get:
cv.cc: In function ‘vecf conv(veci)’:
cv.cc:4:16: warning: parameter ‘a’ set but not used
[-Wunused-but-set-parameter]
4 | vecf conv(veci a) {
| ~~~~~^
cv.cc: In function ‘vecf conv2(veci)’:
cv.cc:11:8: warning: variable ‘tmp’ set but not used
[-Wunused-but-set-variable]
11 | veci tmp = a;
| ^~~
In case anyone else finds this, as a (hopefully temporary) workaround I'm
planning to modify my macro wrapper to use a statement expr to create a
temporary variable which I mark as used using the ((void) foo) trick:
#define SIMDE__CONVERT_VECTOR(to, from) ((to) = (__extension__({ \
__typeof__(from) from_ = (from); \
((void) from_); \
__builtin_convertvector(from_, __typeof__(to)); \
})))
More information about the Gcc-bugs
mailing list