[PATCH] D57523: Fix uninitialized value in ABIArgInfo

2019-02-20 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354546: [NFC] Always initialize all members in ABIArgInfo 
(authored by serge_sans_paille, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D57523?vs=184529&id=187724#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57523

Files:
  cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h


Index: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
===
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
@@ -111,14 +111,15 @@
   }
 
   ABIArgInfo(Kind K)
-  : TheKind(K), PaddingInReg(false), InReg(false), SuppressSRet(false) {
-  }
-
-public:
-  ABIArgInfo()
-  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-TheKind(Direct), 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()
+: ABIArgInfo(Direct) {
+}
 
   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
   llvm::Type *Padding = nullptr,


Index: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
===
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
@@ -111,14 +111,15 @@
   }
 
   ABIArgInfo(Kind K)
-  : TheKind(K), PaddingInReg(false), InReg(false), SuppressSRet(false) {
-  }
-
-public:
-  ABIArgInfo()
-  : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-TheKind(Direct), 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()
+: 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


[PATCH] D57523: Fix uninitialized value in ABIArgInfo

2019-02-20 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

@hans agreed; Thanks for taking the time to try to reproduce the original issue 
o/


Repository:
  rC Clang

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

https://reviews.llvm.org/D57523



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57523: Fix uninitialized value in ABIArgInfo

2019-02-20 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: jdoerfert.
Herald added a project: clang.

I've been staring at this, trying to figure out if the code somehow ends up 
using the uninitialized values, but I can't find it. So either it's hard to 
find, or GCC is doing something wrong.

But anyway, I think committing your change makes sense, but I think don't think 
we can say "Fix uninitialized value in ABIArgInfo", because it's not clear what 
needs fixing. Instead, I'd say "Always initialize the members in ABIArgInfo". 
That kind of makes sense in itself as it makes the code safer and possibly 
simpler, and of course it's also good that it fixes this problem.

What do you think?


Repository:
  rC Clang

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

https://reviews.llvm.org/D57523



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D57523: Fix uninitialized value in ABIArgInfo

2019-01-31 Thread serge via Phabricator via cfe-commits
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