lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master c1feb6d: Prevent a stack overflow


From: Greg Chicares
Subject: [lmi-commits] [lmi] master c1feb6d: Prevent a stack overflow
Date: Fri, 22 Feb 2019 18:36:49 -0500 (EST)

branch: master
commit c1feb6d07cb91efa8b32e7e70722f0eacf46a178
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Prevent a stack overflow
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2019-02/msg00008.html
---
 workhorse.make | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/workhorse.make b/workhorse.make
index 9b4d458..e020d4d 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -694,22 +694,27 @@ endif
 # produces a diagnostic such as
 #   warning: NULL pointer checks disabled:
 #   39933 basic blocks and 167330 registers
-# Adding '-fno-delete-null-pointer-checks' to $(CPPFLAGS) might
-# suffice to suppress the diagnostic, but this file actually doesn't
-# need any optimization at all.
-#
-# The same problem was observed with 'my_db.cpp'. For good measure,
-# all similarly-coded 'my_*.cpp' files are treated the same way.
+# which was historically prevented by specifying '-O0'. In 2019-02,
+# however, with gcc-7.3 and much larger 'my_*.cpp' files, building
+# with '-O0' causes a stack overflow at run time with 32-bit msw,
+# which can be prevented by specifying any optimization option except
+# '-O0'. It appears that the stack overflow is due to the enormity of
+# 'my_db.cpp' in particular. The '-fno-var-tracking-assignments' flag
+# avoids a different issue in 'my_prod.cpp', which contains a very
+# large number of lengthy strings. For simplicity, the same options
+# are used for all 'my_*.cpp' files.
+
+product_file_sources := my_db.o my_fund.o my_prod.o my_rnd.o my_tier.o
 
-my_unoptimizable_files := my_db.o my_fund.o my_prod.o my_rnd.o my_tier.o
+product_file_flags := -Os -fno-var-tracking-assignments -fno-omit-frame-pointer
 
-$(my_unoptimizable_files): optimization_flag := -O0 -fno-omit-frame-pointer
+$(product_file_sources): optimization_flag += $(product_file_flags)
 
 # Blocking optimization in default $(CXXFLAGS) isn't enough, because
 # it is too easily overridden by specifying $(CXXFLAGS) on the command
 # line. This flag overrides such overrides:
 
-$(my_unoptimizable_files): tutelary_flag += -O0 -fno-omit-frame-pointer
+$(product_file_sources): tutelary_flag += $(product_file_flags)
 
 
################################################################################
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]