[PATCH] D57523: Fix uninitialized value in ABIArgInfo

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 31 09:35:47 PST 2019


serge-sans-paille created this revision.
serge-sans-paille added a reviewer: hans.
Herald added a subscriber: cfe-commits.

GCC-9 takes advantage of this uninitialized values to optimize stuff, which ends up in failing validation when compiling clang.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40547


Repository:
  rC Clang

https://reviews.llvm.org/D57523

Files:
  include/clang/CodeGen/CGFunctionInfo.h


Index: include/clang/CodeGen/CGFunctionInfo.h
===================================================================
--- include/clang/CodeGen/CGFunctionInfo.h
+++ include/clang/CodeGen/CGFunctionInfo.h
@@ -111,14 +111,14 @@
   }
 
   ABIArgInfo(Kind K)
-      : TheKind(K), PaddingInReg(false), InReg(false), SuppressSRet(false) {
+      : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+        TheKind(K), PaddingInReg(false), InAllocaSRet(false), IndirectByVal(false),
+        IndirectRealign(false), SRetAfterThis(false), InReg(false),
+        CanBeFlattened(false), SignExt(false), SuppressSRet(false) {}
   }
 
 public:
-  ABIArgInfo()
-      : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-        TheKind(Direct), PaddingInReg(false), InReg(false),
-        SuppressSRet(false) {}
+  ABIArgInfo() : ABIArgInfo(Direct) {}
 
   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
                               llvm::Type *Padding = nullptr,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57523.184529.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190131/520db90b/attachment.bin>


More information about the cfe-commits mailing list