[PATCH] D153146: [CLANG] Fix potential integer overflow value in getRVVTypeSize()

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 22 07:02:26 PDT 2023


Manna updated this revision to Diff 533589.
Manna edited the summary of this revision.
Manna added a comment.

Thank you @erichkeane for review and comments. I have changed the types of variables MinElts and EltSize to uint64_t instead of the cast.


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

https://reviews.llvm.org/D153146

Files:
  clang/lib/AST/ASTContext.cpp


Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -9564,8 +9564,8 @@
 
   ASTContext::BuiltinVectorTypeInfo Info = Context.getBuiltinVectorTypeInfo(Ty);
 
-  unsigned EltSize = Context.getTypeSize(Info.ElementType);
-  unsigned MinElts = Info.EC.getKnownMinValue();
+  uint64_t EltSize = Context.getTypeSize(Info.ElementType);
+  uint64_t MinElts = Info.EC.getKnownMinValue();
   return VScale->first * MinElts * EltSize;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153146.533589.patch
Type: text/x-patch
Size: 550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230622/fab13ec8/attachment.bin>


More information about the cfe-commits mailing list