[Bug c++/70438] New: result type of vector operations
mjh at edg dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 29 15:38:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70438
Bug ID: 70438
Summary: result type of vector operations
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mjh at edg dot com
Target Milestone: ---
The documentation for Vector Extensions says that the relational operations and
logical operations return vectors of the same width and number of elements as
the operands, but with signed integral element type.
In the following example, operations are performed on a vector of floats and an
attempt is made to to assign the result to the same vector, expecting an error,
but no errors are diagnosed. Errors are, however, given when an incompatible
vector type is assigned directly:
typedef float v4sf __attribute__ ((vector_size (16)));
typedef int v4si __attribute__ ((vector_size (16)));
int main() {
v4sf c = {1.0,0.0,1.0,0.0};
v4si x;
/* These assignments are allowed (but shouldn't be?): */
c = !c;
c = c && c;
c = c || c;
c = c == c;
c = c != c;
c = c >= c;
c = c <= c;
c = c < c;
c = c > c;
#if NEG
/* These assignments are not allowed: */
c = x;
c = (v4si){1};
#endif
return 0;
}
I would expect all of these to elicit an error. Am I missing something or is
this a bug?
More information about the Gcc-bugs
mailing list