New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCC 12.1 and LTO yields buffer overflow warnings #740
Comments
Thanks for the heads up. If you are able to edit date.h, can you try changing: CharT buf[std::numeric_limits<unsigned>::digits10+2u] = {};
auto e = buf; to: CharT buf[std::numeric_limits<unsigned>::digits10+2u] = {};
CharT* e = buf; ? (just the second line changes above). I'd try this experiment myself, but I couldn't figure out how to edit date.h on compiler explorer, and I'm so far unable to duplicate on wandbox. Though I did note that on an older clang, with |
Thanks! Ironically I have as much difficulty editing date.h as you, both on CE and on the one place I use it at work (which is where I discovered the issue). Will give it a go! |
This heinous link: https://godbolt.org/z/hPaqz7TY1 shows on line 6514 (!) of the date.h inlined I have modified to |
Thanks for your investigation. At this point I'm tempted to blame it on compiler error. |
Sounds good to me! I'll file it, closing this! |
The gcc bug I filed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106020 |
With LTO and optimization, and with some datetime functions referenced across TUs, GCC 12.1 errors about
std::move()
moving things into temporary buffers:This took a while to repro, but:https://godbolt.org/z/e75YG6ano and could easily be a compiler bug, but I figured I'd post here first of all. This code has been working fine for years on earlier compilers (not that that's a guarantee of correctness!).
The text was updated successfully, but these errors were encountered: