<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
When this option (unaligned access) was initially added the discussion<br>
ended with the default being conservative and correct. Subtarget can<br>
surely redefine it, if necessary (like Darwin).<br></blockquote><div><br></div><div style>Do you have a reference to the original discussion?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

So, the proper solution here would be:<br>
<br>
1. Allow unaligned access on Linux<br>
2. Add flag to control the behavior<br>
3. Left the current conservative behavior for everything else<br></blockquote><div><br></div><div style>I'm not sure I agree: as you said subtargets can redefine the value, and in other cases GCC's behavior is matched. Specifically I made this fix for PNaCl, and I didn't want to fix performance just for PNaCl and ignore other platforms, so I dug into what GCC and Linux do, and the rationale seems sane: ARMv7 hardware has a feature to trap on unaligned accesses but that feature is AFAIK used by OSes as a system-wide setting (not per-process). ARMv7 hardware *must* support unaligned accesses, it's just a question of whether the OS configures them to trap. I tried explaining this in the code, see ARM ARM revC "A3.2.1 Unaligned data access" for more details.</div>
<div style><br></div><div style>My fix therefore follows what seems to be the sane way to use ARMv7 hardware, but this can always be overwritten with the -arm-strict-align flag. Do you think that my assessment of "sane behavior on ARMv7" is incorrect, and do you have subtarget examples where this would be a bad thing?</div>
<div style><br></div><div style><br></div><div style><br></div></div></div></div>