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

            Bug ID: 121655
           Summary: After using reinterpret_cast on a static variable and
                    passing its address as a template parameter, an
                    internal compiler error occurred
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 13330742392 at wo dot cn
  Target Milestone: ---

For information on the problematic compiler version and compiler commands,
refer to this Godbolt link: https://godbolt.org/z/91W5bGqrq.

The cause of this bug remains difficult to determine even after discussions
within the Stack Overflow community. The most plausible possibility is that
using reinterpret_cast on the address of a static variable undermines the
compile-time constant nature of the static variable's address, and GCC fails to
handle this scenario correctly.

Anyway, all I know is that when GCC encounters this code, it may either throw
an internal compiler error or compile successfully.

The detailed problem and minimal reproducible code have been posted at
https://stackoverflow.com/questions/79744696/an-internal-compiler-error-ice-is-encountered-with-gcc-and-compiling-with-cla,
so I won't paste the code examples here.

Reply via email to