title: How to change optimization level of one function?
body: <p>This is related to <a href="https://stackoverflow.com/q/31373765">Determine cause of segfault when using -O3?</a> In the question, I'm catching a segfault in a particular function when compiled with <code>-O3</code> using a particular version of GCC. At <code>-O3</code>, vectorization instructions are used (at <code>-O2</code>, they are not used).</p>
  
  <p>I want to wrap a single function in a lower optimization level. According to <a href="https://stackoverflow.com/q/395145/608639">Switching off optimization for a specific function in GCC 4.2.2</a>, I can do it. However, following the various links in the question and answers, I don't find an answer for <em>"how, exactly, to do it"</em>.</p>
  
  <p>How do I mark a single function to use a different optimization level?</p>
  
  <hr>
  
  <p>Related, I don't want to move this function to a separate file, and then provide a different makefile recipe for it. Doing that opens another can of worms, like applying it to GCC 4.9 only on some platforms.</p>