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,


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,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to