[PATCH] D14744: PR10235: support for vector mode attributes + warning
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 18 07:09:56 PST 2015
DmitryPolukhin added inline comments.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:3315
@@ +3314,3 @@
+ llvm::APInt VectorSize(64, 0);
+ if (Str.size() >= 4 && Str[0] == 'V') {
+ // Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).
----------------
aaron.ballman wrote:
> Can you have a vector of vectors with mode? I'm wondering why this isn't part of parseModeAttr(), since this is parsing part of the mode attribute.
No, it is not possible and more over it is not allowed to combine vector_size and vector mode (GCC does the same). Checks below prevent non-primitive types as vector elements.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:3318
@@ +3317,3 @@
+ int VectorStringLength = 0;
+ while (isdigit(Str[VectorStringLength + 1]))
+ ++VectorStringLength;
----------------
aaron.ballman wrote:
> This will cause a buffer overrun on pathological code; should also constrain based on the size of Str.
Thank you for catching this!
http://reviews.llvm.org/D14744
More information about the cfe-commits
mailing list