MPS issue job003888

TitleTESTT segfaults if pointer is not aligned
Statussuspended
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionIf you give an unaligned pointer to TESTT then it segfaults. It would improve error reporting if unaligned pointers resulted in assertion failures rather than segfaults.

Found by MMQA test argerr/1.c (and many similar tests).
AnalysisThe TESTT macro could check that the pointer is aligned. But maybe this would just slow down the MPS for a problem that doesn't occur very often and is fairly easily diagnosable via the segfault?

Here's a performance comparison in the master sources at changelevel 187257 with seed 1590515072. Running "gcbench -x 1590515072 amc" I get:

        xci6ll w3i6mv lii6ll
check? hot cool hot cool hot cool
NO 47.8 253.7 8.8 138.7 38.4 170.2
YES 47.8 190.1 8.8 136.9 33.0 172.6

So the additional alignment check mostly improves the performance. Not sure why this is. Disassembly shows that the code is much as expected on x86_64 (two extra instructions in the hot variety, and four in the cool variety for the additional alignment check). Maybe this check comes for free while waiting for the signature to load?
How foundautomated_test
EvidenceNone.
Test procedureargerr/1.c
Created byGareth Rees
Created on2014-10-13 18:22:15
Last modified byGareth Rees
Last modified on2014-10-20 17:04:28
History2014-10-13 GDR Created.