{"id":549,"date":"2022-08-30T15:03:12","date_gmt":"2022-08-30T15:03:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/is-this-a-bug-in-the-vc-optimizer-or-in-my-code-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:03:12","modified_gmt":"2022-08-30T15:03:12","slug":"is-this-a-bug-in-the-vc-optimizer-or-in-my-code-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/is-this-a-bug-in-the-vc-optimizer-or-in-my-code-collection-of-common-programming-errors\/","title":{"rendered":"is this a bug in the VC++ optimizer or in my code?-Collection of common programming errors"},"content":{"rendered":"<p>Tried the following vector subtraction code with a console project generated by VS2012 Update 1. I didn&#8217;t really touch the default options other than disabling global optimizations and enabling assembler listings.<\/p>\n<p>Compiled with x64 release configuration on Windows 7 x64 SP1.<\/p>\n<pre><code>#include \n#include \n\n#include \n\ntypedef unsigned short ushort;\ntypedef unsigned int uint;\n\nvoid print(__m128i i)\n{\n    auto&amp; arr = i.m128i_u16;\n    printf(\"[%d %d  %d  %d  %d  %d  %d  %d]\\n\", arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]);\n}\n\nint _tmain(int argc, _TCHAR* argv[])\n{\n    const int lineSize = 912;\n    ushort input[lineSize];\n    ushort vals[lineSize];\n\/\/  printf(\"%X %X\\n\", input, vals); \/\/ note this one\n\n    for (uint i=0; i<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 20:50:38. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Tried the following vector subtraction code with a console project generated by VS2012 Update 1. I didn&#8217;t really touch the default options other than disabling global optimizations and enabling assembler listings. Compiled with x64 release configuration on Windows 7 x64 SP1. #include #include #include typedef unsigned short ushort; typedef unsigned int uint; void print(__m128i i) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-549","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=549"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/549\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}