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

--- Comment #3 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Another example is edb-debugger project
https://github.com/eteran/edb-debugger/blob/070d0196227a58ce2ba15c695944ba16ce66c080/plugins/DebuggerCore/unix/linux/arch/x86-generic/PlatformThread.cpp#L331:

  long PlatformThread::setDebugRegister(std::size_t n, unsigned long value) {
        return ptrace(PTRACE_POKEUSER, tid_, offsetof(struct user,
u_debugreg[n]), value);
  }

Fails build on gcc-11 as:

 
edb-debugger/plugins/DebuggerCore/unix/linux/arch/x86-generic/PlatformThread.cpp:331:72:
error: 'n' is not a constant expression
    331 |  return ptrace(PTRACE_POKEUSER, tid_, offsetof(struct user,
u_debugreg[n]), value);
        |                                       ^

Reply via email to