<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>fridaynight</author_name>
  <author_url>https://blog.hatena.ne.jp/fridaynight/</author_url>
  <blog_title>豪鬼メモ</blog_title>
  <blog_url>https://mikio.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>GCCの不可解な挙動に悩まされている。以下のコードは、負数を出力しないことが期待されるが、-O2以上の最適化をすると負数が出力されてしまう。 #include &lt;cstdint&gt; #include &lt;cstdio&gt; int main(int argc, char** argv) { constexpr uint32_t modulo = 2039; for (int32_t i = 0; i &lt; 65536; i++) { const int32_t result = static_cast&lt;uint32_t&gt;(i * i) % modulo; std::printf(&quot;%d\n&quot;, resu…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmikio.hatenablog.com%2Fentry%2F2021%2F09%2F08%2F175148&quot; title=&quot;キャストに関わるGCCの謎挙動 - 豪鬼メモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-09-08 17:51:48</published>
  <title>キャストに関わるGCCの謎挙動</title>
  <type>rich</type>
  <url>https://mikio.hatenablog.com/entry/2021/09/08/175148</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
