From: Martin v. Löwis Date: Wed, 1 Aug 2012 08:32:11 +0000 (+0200) Subject: Issue #8847: Disable COMDAT folding in Windows PGO builds. X-Git-Tag: v3.3.0b2~75^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c1730db7c8735d2424471e63a2fa7d690192899;p=python Issue #8847: Disable COMDAT folding in Windows PGO builds. Analysis by Victor Stinner. Patch by Stefan Krah. --- diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index d7e6629ba7..84b8afe3a4 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -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) diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py index 1464a0e50f..6e934fb882 100644 --- a/Lib/test/test_tuple.py +++ b/Lib/test/test_tuple.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index 9a5aff4108..671878f44a 100644 --- 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. diff --git a/PCbuild/pginstrument.vsprops b/PCbuild/pginstrument.vsprops index 38c5f18ed3..99c117b152 100644 --- a/PCbuild/pginstrument.vsprops +++ b/PCbuild/pginstrument.vsprops @@ -22,7 +22,7 @@