https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119141

            Bug ID: 119141
           Summary: ub sanitizer incorrect overflow detection
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kelbonage at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/z97EGxjeP

#include <chrono>

int main() {
    std::chrono::nanoseconds ns = std::chrono::milliseconds::max();
}

opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/chrono.h:227:38:
runtime error: signed integer overflow: 9223372036854775807 * 1000000 cannot be
represented in type 'long int'

Reply via email to