summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-05-26 15:17:54 +0900
committerGitHub <noreply@github.com>2019-05-26 15:17:54 +0900
commitf09971098eab6442fa0f4fdf395642f67394d3bd (patch)
tree322fb4e5e525af486e75b6acb161debaac631050
parent1b85f4ec45a5d63188ee3866bd55eb29fdec7fbf (diff)
downloadcpython-git-revert-13569-undo-ea2b76bdc5f97f49701213d105b8ec2387ea2fa5.tar.gz
Revert "[3.7] Revert "align PyGC_Head to alignof(long double) (GH-13335)" (GH-13569)"revert-13569-undo-ea2b76bdc5f97f49701213d105b8ec2387ea2fa5
This reverts commit 2156fec1f7a8f9972e90cdbaf404e3fd9eaccb35.
-rw-r--r--Include/objimpl.h6
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst2
2 files changed, 7 insertions, 1 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 057bb50cbd..0436ba7899 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -255,7 +255,11 @@ typedef union _gc_head {
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
+ // malloc returns memory block aligned for any built-in types and
+ // long double is the largest standard C type.
+ // On amd64 linux, long double requires 16 byte alignment.
+ // See bpo-27987 for more discussion.
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
new file mode 100644
index 0000000000..97ca37b262
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
@@ -0,0 +1,2 @@
+``PyGC_Head`` structure is aligned to ``long double``. This is needed to
+GC-ed objects are aligned properly. Patch by Inada Naoki.