Skip to content

Instantly share code, notes, and snippets.

@derrickturk
Created March 21, 2014 22:06
Show Gist options
  • Save derrickturk/9697487 to your computer and use it in GitHub Desktop.
Save derrickturk/9697487 to your computer and use it in GitHub Desktop.
Death by misalignment...
Public service announcement: use extreme caution when compiling under g++ with -msseX and returning a std::pair<double, double>, or the structural equivalent, by value. It will optimize to a movapd, which works wonderfully as long as you're returning into a 16-bit aligned address. But you'll mysteriously explode in a shower of body parts if calling into, say, a DLL from external code (say, Excel VBA) with a less-strictly aligned stack.
No, I didn't just spend 5 hours tracking that one down...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment