[PATCH] D79012: [AST] Fix a crash on a dependent vector_size attribute

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 10:12:28 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2bb686b4b629: [AST] Fix a crash on a dependent vector_size attribute (authored by erik.pilkington).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79012/new/

https://reviews.llvm.org/D79012

Files:
  clang/lib/AST/ASTContext.cpp
  clang/test/SemaCXX/vector.cpp


Index: clang/test/SemaCXX/vector.cpp
===================================================================
--- clang/test/SemaCXX/vector.cpp
+++ clang/test/SemaCXX/vector.cpp
@@ -475,3 +475,12 @@
 #endif // __cplusplus >= 201103L
 }
 }
+
+namespace rdar60092165 {
+template <class T> void f() {
+  typedef T first_type __attribute__((vector_size(sizeof(T) * 4)));
+  typedef T second_type __attribute__((vector_size(sizeof(T) * 4)));
+
+  second_type st;
+}
+}
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -3694,10 +3694,10 @@
       (void)CanonCheck;
       DependentVectorTypes.InsertNode(New, InsertPos);
     } else {
-      QualType CanonExtTy = getDependentSizedExtVectorType(CanonVecTy, SizeExpr,
-                                                           SourceLocation());
+      QualType CanonTy = getDependentVectorType(CanonVecTy, SizeExpr,
+                                                SourceLocation(), VecKind);
       New = new (*this, TypeAlignment) DependentVectorType(
-          *this, VecType, CanonExtTy, SizeExpr, AttrLoc, VecKind);
+          *this, VecType, CanonTy, SizeExpr, AttrLoc, VecKind);
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79012.260685.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200428/49573df1/attachment.bin>


More information about the cfe-commits mailing list