Hi,

Recently, devel/llvm (the port) has copied the -msave-args diff from
base, and it resulted lang/rust to segfault.

Since, the change has been backouted, but I continued searching the root
cause as the diff is on base too.

and I think the culprit is SaveArgs variable member in class X86Subtarget.

If -msave-args is used, it is set to `true'.
If -mno-save-args is used, it is set to `false'.
But else, it lefts uninitialized.

As the value is a boolean, I changed type from unsigned to bool, and set
the default value.

I didn't test it on base, but with such patch on devel/llvm, rust is
able to compile correctly.

-- 
Sebastien Marie

Index: lib/Target/X86/X86Subtarget.h
===================================================================
RCS file: /cvs/src/gnu/llvm/lib/Target/X86/X86Subtarget.h,v
retrieving revision 1.4
diff -u -p -r1.4 X86Subtarget.h
--- lib/Target/X86/X86Subtarget.h       30 Jan 2019 03:08:12 -0000      1.4
+++ lib/Target/X86/X86Subtarget.h       4 Feb 2019 15:44:11 -0000
@@ -401,7 +401,7 @@ protected:
   unsigned stackAlignment = 4;
 
   /// Whether function prologues should save register arguments on the stack.
-  unsigned SaveArgs;
+  bool SaveArgs = false;
 
   /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
   ///
@@ -481,7 +481,7 @@ public:
     return &getInstrInfo()->getRegisterInfo();
   }
 
-  unsigned getSaveArgs() const { return SaveArgs; }
+  bool getSaveArgs() const { return SaveArgs; }
 
   /// Returns the minimum alignment known to hold of the
   /// stack frame on entry to the function and which must be maintained by 
every

Reply via email to