On Sat, 9 Dec 2023 at 03:53, Paul Smith via Gcc <gcc@gcc.gnu.org> wrote:
>
> I've tried this with both older versions as well as GCC 12.3 (latest I
> have access to).  This is on GNU/Linux on x86_64.
>
>
> I have the following code:
[...]
> I'm assuming a bug should be filed for this ICE (can anyone repro it in
> the current release?), but does anyone know if there's any way to make
> it work in GCC 12.3?

If it is suitable to modify the source code of the application, a workaround
is to let the constructor take a ref/ptr to va_list instead, and wrap a call to
it inside a variadic C-style function, or a variadic static member function,
that creates and returns the Exception object. An example at [1].
-----
The ICE isn't a problem here, since the string-index and first-to-check
attr-parameters of [2] should not consider any hidden func-parameters
except the 'this' pointer. The values 2 and 3 resp. are therefore the
correct arguments to pass to the attr-parameters for the given c++
code utilizing virtual inheritance.

What is missing from 12.3.0 (and also from the latest on the
releases/gcc-12 branch) is the adjustments, that the compiler must
internally make, to the arguments passed to the attr-parameters, when
virtual inheritance adds 1 or 2 additional hidden func-parameters to the
constructor.

The gcc-13 branch does contain those adjustments. See [3].
The last comment on it is:
---------------
    Marek Polacek 2022-05-07 14:59:02 UTC
    Fixed for GCC 13.  I don't have plans to backport this.
---------------
[1] https://godbolt.org/z/bh9df9xGP
[2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101833

Reply via email to