This is an archive of the discontinued LLVM Phabricator instance.

Catch invalid bitwise operation on vector of floats
ClosedPublic

Authored by sepavloff on May 31 2017, 11:11 AM.

Details

Summary

Bitwise complement applied to vector of floats described with
attribute ext_vector_type is not diagnosed as error. Attempt to
compile such construct causes assertion violation in Instruction.cpp.
With this change the complement is treated similar to the case of
vector type described with attribute vector_size.

Event Timeline

sepavloff created this revision.May 31 2017, 11:11 AM
bruno added a subscriber: bruno.Jun 2 2017, 1:35 PM

Hi,

test/Sema/types.c
92

Can you also add a test for the vector_type variant? It might be more appropriate to put this at test/Sema/ext_vector* and test/Sema/vector*

sepavloff added inline comments.Jun 4 2017, 11:32 AM
test/Sema/types.c
92

The test for the vector_type variant already exists in test/Sema/vector-ops.c. I tried to made similar test file for ext_vector_type by copying vector-ops.c and replacing vector types accordingly, but there are many differences in diagnostic, so only the part that checks the complement operation was copied.

sepavloff updated this revision to Diff 101359.Jun 4 2017, 11:39 AM

Updated regression test

The new regression test was obtained from Sema/vector-ops.c, the part of
it that checks binary complement was copied.

bruno accepted this revision.Jun 6 2017, 2:52 PM

LGTM

test/Sema/ext_vector_ops.c
22 ↗(On Diff #101359)

Can you file a PR for this?

This revision is now accepted and ready to land.Jun 6 2017, 2:52 PM
This revision was automatically updated to reflect the committed changes.