View Issue Details

IDProjectCategoryView StatusLast Update
0000572OpenMPT[All Projects] libopenmptpublic2016-08-07 19:08
ReportermanxAssigned ToSaga Musix 
PriorityhighSeveritycrashReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version 
Target VersionOpenMPT 1.27.01.00 / libopenmpt 0.3.1 (upgrade first)Fixed in VersionOpenMPT 1.27.01.00 / libopenmpt 0.3.1 (upgrade first) 
Summary0000572: Avoid non-standard language extensions for structure packing
Description

All currently supported compilers provide C++ language extensions for tightly packed structures (and thus non-naturally aligned structure members): MSVC via #pragma pack; GCC, Clang and emscripten via attribute((packed)).
Emscripten discourages their usage.
However, none of these compilers are able to detect and warn about all cases in which pointers to unaligned members escape a scope where the unanlignedness is known to the compiler. This causes crashes (or really slow software fixup traps) on any architecture that does require aligned memory access (old ARM, MIPS, SPARC).
It is also generally desireable to (at least optionally) express as much as possible in fully standard conforming C++.

Additional Information

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41809
https://stackoverflow.com/questions/8568432/is-gccs-attribute-packed-pragma-pack-unsafe
https://stackoverflow.com/questions/17146792/why-do-i-get-a-warning-for-an-unaligned-pointer-but-not-a-reference
Some problems can be detected at runtime on x86 with clang/gcc asan/uban.

TagsNo tags attached.
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Relationships

child of 0000783 new cross-platform OpenMPT 

Activities

Saga Musix

Saga Musix

2016-08-07 19:08

administrator   ~0002561

Implemented in r6783.

Issue History

Date Modified Username Field Change
2014-08-22 07:25 manx New Issue
2014-08-22 07:25 manx Status new => assigned
2014-08-22 07:25 manx Assigned To => manx
2014-12-12 10:42 manx Priority normal => high
2014-12-12 10:42 manx Severity minor => major
2015-08-15 07:01 manx Description Updated View Revisions
2015-08-15 07:01 manx Additional Information Updated View Revisions
2015-09-05 10:41 manx Additional Information Updated View Revisions
2016-05-04 08:07 manx Severity major => crash
2016-05-04 08:07 manx Target Version OpenMPT 1.?? (long term goals) => OpenMPT 1.?? (libopenmpt 1.0) (goals)
2016-05-04 08:07 manx Additional Information Updated View Revisions
2016-05-09 09:30 manx Relationship added child of 0000783
2016-07-31 17:21 Saga Musix Assigned To manx => Saga Musix
2016-07-31 17:21 Saga Musix Target Version OpenMPT 1.?? (libopenmpt 1.0) (goals) => OpenMPT 1.27.01.00 / libopenmpt 0.3.1 (upgrade first)
2016-08-07 19:08 Saga Musix Status assigned => resolved
2016-08-07 19:08 Saga Musix Resolution open => fixed
2016-08-07 19:08 Saga Musix Fixed in Version => OpenMPT 1.27.01.00 / libopenmpt 0.3.1 (upgrade first)
2016-08-07 19:08 Saga Musix Note Added: 0002561