From 93bed2c3bd2a24be2c036b29cbd0bb9075b4f1e9 Mon Sep 17 00:00:00 2001
From: Nehal J Wani <nehaljw.kkd1@gmail.com>
Date: Fri, 5 Jan 2018 08:46:24 -0600
Subject: [PATCH 2/2] Extend default flags for win-32

---
 theano/gof/cmodule.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/theano/gof/cmodule.py b/theano/gof/cmodule.py
index b2fc66f1c..acd94e1a5 100644
--- a/theano/gof/cmodule.py
+++ b/theano/gof/cmodule.py
@@ -2181,11 +2181,14 @@ class GCC_compiler(Compiler):
             # '-fPIC ignored for target (all code is position independent)'
             cxxflags.append('-fPIC')
 
-        if sys.platform == 'win32' and local_bitwidth() == 64:
-            # Under 64-bit Windows installation, sys.platform is 'win32'.
-            # We need to define MS_WIN64 for the preprocessor to be able to
-            # link with libpython.
-            cxxflags.append('-DMS_WIN64')
+        if sys.platform == 'win32':
+            if local_bitwidth() == 64:
+                # Under 64-bit Windows installation, sys.platform is 'win32'.
+                # We need to define MS_WIN64 for the preprocessor to be able to
+                # link with libpython.
+                cxxflags.append('-DMS_WIN64')
+            elif local_bitwidth() == 32:
+                cxxflags.append('-DMS_WIN32 -mstackrealign')
 
         if sys.platform == 'darwin':
             # Use the already-loaded python symbols.
-- 
2.14.1

