<div dir="ltr"><div>Ok, so how do you know WHAT to use as '__alignof__' in the C code that allocates memory for a void* with a size_t? Because that is, typically, the stuff that happens in APIs of the type that I expect this to be useful in. (And yes, if we add a `align` value to the allocator, then that's fixing the problem, but I don't see that happening right now). <br><br>I appreciate that maybe I've misunderstood the whole concept, and this is useless. In which case, i'd appreciate a suggestion on how to MAKE it useful. <br><br>And by the way, if you were to make, say something like this:<br><br> if (opts.noSSE2) SuitableAlignment = 64;<br> <br>in Targets.cpp, as long as that is done before the preprocessor is initialized (and from my understanding, it does), then my change will work just fine [Well, subject to compiling ALL of the code with the same settings]. <br><br>I'm probably missing some big thing that I'm not at all understanding... I can be a bit simple in how I see things at times... <br></div><div><br></div><div>-- <br>Mats</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 December 2014 at 22:26, Jonathan Roelofs <span dir="ltr"><<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 12/13/14 2:32 PM, Joerg Sonnenberger wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sat, Dec 13, 2014 at 09:15:53PM +0000, mats petersson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, what kind of documentation would you like to see?<br>
<br>
The GCC docs here:<br>
<a href="https://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html" target="_blank">https://gcc.gnu.org/<u></u>onlinedocs/gcc/Variable-<u></u>Attributes.html</a><br>
<br>
say: GCC also provides a target specific macro __BIGGEST_ALIGNMENT__, which<br>
is the largest alignment ever used for any data type on the target machine<br>
you are compiling for.<br>
</blockquote>
<br>
How does that interact with codegen flags like -mno-sse2? What about<br>
support for new target types in later version -- from the writing it is<br>
nowhere clear that this macro is not fixed.<br>
</blockquote></span>
The gcc page on it says that it *can* change with codegen flags, and I agree, it says nothing about when it will change, nor how flags affect it.<br>
<br>
Given that, my feeling is that Mats' intent on use of this macro is wrong. __BIGGEST_ALIGNMENT__ should be used in the same way that the int*_fast_t types are: where you don't care about the actual alignment, but you just want an alignment that is 'fast' on the platform.<span class=""><br>
<br>
<br>
"we discussed some code that had accidentally aligned it's sub-allocated block to 4 bytes for a 64-bit type, and got a unaligned access trap."<br>
<br></span>
For that, you should probably be using __alignof__.<br>
<br>
<br>
Jon<span class="im HOEnZb"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Joerg<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote>
<br></span><span class="im HOEnZb">
-- <br>
Jon Roelofs<br>
<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
CodeSourcery / Mentor Embedded<br></span><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>