On Tue, Feb 19, 2019 at 10:17 PM Gabriele Svelto <gsve...@mozilla.com> wrote: > On the reverse I've seen performance regressions from using > -fno-strict-aliasing only in tight loops where the inability to move > accesses around was lengthening the critical path through the loop. > However this was on processors with very limited memory reordering > capabilities; my guess is that on today's hardware > -fno-strict-aliasing's impact is lost in the noise.
Given the replies to this thread and especially the one I quoted above, I suggest appending the following paragraph after the first paragraph of https://developer.mozilla.org/en-US/docs/Mozilla/Using_CXX_in_Mozilla_code : On the side of extending C++, we compile with -fno-strict-aliasing. This means that when reinterpreting a pointer as a differently-typed pointer, you don't need to adhere to the "effective type" (of the pointee) rule from the standard when dereferencing the reinterpreted pointer. You still need make sure that you don't violate alignment requirements and need to make sure that the data at the memory location pointed to forms a valid value when interpreted according to the type of the pointer when dereferencing the pointer for reading. Likewise, if you write by dereferencing the reinterpreted pointer and the originally-typed pointer might still be dereferenced for reading, you need to make sure that the values you write are valid according to the original type. This issue is moot for e.g. primitive integers for which all bit patterns of their size are valid value. -- Henri Sivonen hsivo...@mozilla.com _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform