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

            Bug ID: 124468
           Summary: -fsanitize=undefined giving compiler error on
                    std::define_static_string, while not using it doesn't
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uchanahome8 at gmail dot com
  Target Milestone: ---

Hi, it seems that when I use -fsanitize=undefined, the following consteval code
is giving compiler error, but if I don't use -fsanitize=undefined, it is
compiling fine.


Working link: https://godbolt.org/z/75sharraY
Non working link (with exactly same code): https://godbolt.org/z/4cqa18qqK

Given that compile-time code is supposed to be UB free, it is odd that using or
not using the `-fsanitize=undefined` is making a difference here (it shouldn't,
right?)

I am guessing that (((const char*)(&"x")) == 0) is illegal at compile time
because it involves reinterpret_cast, but not 100% sure.
  • [Bug c++/124468] New: -fsanitize... uchanahome8 at gmail dot com via Gcc-bugs

Reply via email to