]> granicus.if.org Git - python/commitdiff
Issue #8847: Disable COMDAT folding in Windows PGO builds.
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 1 Aug 2012 08:32:11 +0000 (10:32 +0200)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 1 Aug 2012 08:32:11 +0000 (10:32 +0200)
Analysis by Victor Stinner. Patch by Stefan Krah.

Lib/test/test_list.py
Lib/test/test_tuple.py
Misc/NEWS
PCbuild/pginstrument.vsprops

index d7e6629ba7c16366717fa783db067c0f5d13c15c..84b8afe3a433f26acac37f83f272a5628dc2f0e4 100644 (file)
@@ -70,6 +70,14 @@ class ListTest(list_tests.CommonTest):
         check(1000000)
 
 
+    def test_no_comdat_folding(self):
+        # Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
+        # optimization causes failures in code that relies on distinct
+        # function addresses.
+        class L(list): pass
+        with self.assertRaises(TypeError):
+            (3,) + L([1,2])
+
 def test_main(verbose=None):
     support.run_unittest(ListTest)
 
index 1464a0e50f491611d6ba0a077424d75833d1aa83..6e934fb8825d7066dee9a9cf194480615d91c967 100644 (file)
@@ -164,6 +164,14 @@ class TupleTest(seq_tests.CommonTest):
         check(10)       # check our checking code
         check(1000000)
 
+    def test_no_comdat_folding(self):
+        # Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
+        # optimization causes failures in code that relies on distinct
+        # function addresses.
+        class T(tuple): pass
+        with self.assertRaises(TypeError):
+            [3,] + T((1,2))
+
 def test_main():
     support.run_unittest(TupleTest)
 
index 9a5aff4108d5ba2011d08fde43696ee291c14ce5..671878f44a973d308aa5e5f3f4591145497e14d1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -425,6 +425,8 @@ Tests
 Build
 -----
 
+- Issue #8847: Disable COMDAT folding in Windows PGO builds.
+
 - Issue #14197: For OS X framework builds, ensure links to the shared
   library are created with the proper ABI suffix.
 
index 38c5f18ed316c14585c1e89ae529454cab62c5bb..99c117b15267f071c40aeeb5fbfa7745819b018a 100644 (file)
@@ -22,7 +22,7 @@
        <Tool\r
                Name="VCLinkerTool"\r
                OptimizeReferences="2"\r
-               EnableCOMDATFolding="2"\r
+               EnableCOMDATFolding="1"\r
                LinkTimeCodeGeneration="2"\r
                ProfileGuidedDatabase="$(SolutionDir)$(PlatformName)-pgi\$(TargetName).pgd"\r
                ImportLibrary="$(OutDirPGI)\$(TargetName).lib"\r