Title | TESTT segfaults if pointer is not aligned |
Status | suspended |
Priority | nice |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | If 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). |
Analysis | The 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 found | automated_test |
Evidence | None. |
Test procedure | argerr/1.c |
Created by | Gareth Rees |
Created on | 2014-10-13 18:22:15 |
Last modified by | Gareth Rees |
Last modified on | 2014-10-20 17:04:28 |
History | 2014-10-13 GDR Created. |