I found the gcc bugzilla thread. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
It is weird that optimization affects the warning? I was hoping the `(void)` would get rid of it for just this case. You can close if you believe the optimization should affect the warnings given. Probably the pass to report it is not executed at level 0. ** Bug watch added: GCC Bugzilla #66425 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1837329 Title: C unsed results warning when optiming To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1837329/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs