STINNER Victor added the comment:
2014-03-24 0:30 GMT+01:00 Antoine Pitrou rep...@bugs.python.org:
What is the size of the PyASCIIObject on x86/x64 with and without the
patch?
Haven't tried on x86, but on x86-64 it's the same. If it changes it will
probably get detected by the
Antoine Pitrou added the comment:
Look at the commits, not the patch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
STINNER Victor added the comment:
Look at the commits, not the patch.
Ah! You wrote Ok, I've committed the patch. Ok, your commit is fine. I would
prefered a named field (called padding), but it's fine ;-)
--
___
Python tracker
Mark Lawrence added the comment:
Martin, Larry msg214639 states Fix PyUnicode_DATA() alignment under m68k.,
your comments please.
--
nosy: +BreamoreBoy, larry, loewis
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
Stefan Krah added the comment:
Mark Lawrence, stop playing off committers against each other. This is
outright trolling.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
Andreas Schwab added the comment:
The attached patch has been tested on
{i586,x86_64,ppc,ppc64,ppc64le,armv6hl,armv7hl,aarch64,m68k}-suse-linux.
--
keywords: +patch
Added file: http://bugs.python.org/file34589/pyasciiobject-align.patch
___
Python
Changes by Andreas Schwab sch...@linux-m68k.org:
Removed file: http://bugs.python.org/file32554/xx
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
Antoine Pitrou added the comment:
Are unnamed struct fields actually valid C?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Stefan Krah added the comment:
Yes, ยง6.7.2.1:
A bit-field declaration with no declarator, but only a colon and a width,
indicates an unnamed bit-field.
With a footnote:
105) An unnamed bit-field structure member is useful for padding to conform to
externally imposed layouts.
Unnamed
Roundup Robot added the comment:
New changeset 004ae1472a43 by Antoine Pitrou in branch '3.4':
Issue #19537: Fix PyUnicode_DATA() alignment under m68k. Patch by Andreas
Schwab.
http://hg.python.org/cpython/rev/004ae1472a43
New changeset 0128b25068de by Antoine Pitrou in branch 'default':
Antoine Pitrou added the comment:
Ok, I've committed the patch, then. Thank you, Andreas.
--
resolution: - fixed
stage: needs patch - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
What is the size of the PyASCIIObject on x86/x64 with and without the
patch? GCC and Visual Studio provide attributes to align structures.
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
What is the size of the PyASCIIObject on x86/x64 with and without the
patch?
Haven't tried on x86, but on x86-64 it's the same. If it changes it will
probably get detected by the sys.getsizeof() tests.
--
___
STINNER Victor added the comment:
If you compile Python with GCC, we can maybe try something with __attribute__
((aligned (sizeof(void * attribute. The attribute can be used on a
structure field. The problem is that we don't care of the alignment of header
attributes, only of data, but
Serhiy Storchaka added the comment:
I think that adding __attribute__ ((aligned (sizeof(void * to the PyObject
type (or to the ob_base field) is enough.
If first byte of structure is aligned, then first byte past the structure
should be aligned too.
--
Serhiy Storchaka added the comment:
Antoine, if sizeof(PyUnicodeObject) is 38, the start of UCS4 unicode string is
not aligned. This should be fixed.
--
stage: patch review - needs patch
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
Antoine, if sizeof(PyUnicodeObject) is 38, the start of UCS4 unicode
string is not aligned. This should be fixed.
Probably. Does anyone want to propose a patch?
--
___
Python tracker rep...@bugs.python.org
Andreas Schwab added the comment:
How about adding explicit padding to the bitfield in PyASCIIObject?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
Antoine Pitrou added the comment:
How about adding explicit padding to the bitfield in PyASCIIObject?
That sounds ok to me, but it must be explicitly for 68k (or use a
sufficiently smart scheme not to affect already aligned architectures).
--
___
Stefan Krah added the comment:
(gdb) p sizeof(PyASCIIObject)
$1 = 22
If the only issue is that the size should be 24 instead of 22,
could we perhaps add an unused uint16_t to the struct just
for this architecture?
--
nosy: +skrah
___
Python
Serhiy Storchaka added the comment:
What is sizeof(PyUnicodeObject)?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Andreas Schwab added the comment:
(gdb) p sizeof(PyUnicodeObject)
$1 = 38
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list
Changes by Stefan Krah stefan-use...@bytereef.org:
--
nosy: -skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list
Changes by Stefan Krah stefan-use...@bytereef.org:
--
nosy: +skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Python-bugs-list
Serhiy Storchaka added the comment:
Current code assumes that PyUnicode_DATA() is aligned to PyUnicode_KIND()
bytes. If this is not true on some platform it will be easer to add a padding
than rewrite a code. A lot of code depends on this assumption. See also
issue14422.
I afraid that
Antoine Pitrou added the comment:
I don't understand in which concrete situation the current code could be wrong.
The start of the unicode string should always be aligned, due to how unicode
objects are allocated.
--
___
Python tracker
Andreas Schwab added the comment:
(gdb) p sizeof(PyASCIIObject)
$1 = 22
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
Stefan Krah added the comment:
Andreas Schwab rep...@bugs.python.org wrote:
(gdb) p sizeof(PyASCIIObject)
$1 = 22
m68k again? ;)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
Andreas Schwab added the comment:
There is nothing wrong with that.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
___
New submission from Andreas Schwab:
sizeof(foo) is never a good approximation for the alignment of foo
--
components: Interpreter Core
files: xx
messages: 202487
nosy: schwab
priority: normal
severity: normal
status: open
title: Fix misalignment in fastsearch_memchr_1char
type: behavior
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +serhiy.storchaka
stage: - patch review
versions: +Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19537
___
32 matches
Mail list logo