Re: [PATCH] arc: Fix gcc-4.8 compilation failure for arc.c

Shahab Vahedi via Gdb-patches
2021-02-09T17:02:58Z

On Tue, Feb 09, 2021 at 07:52:42AM -0700, Tom Tromey wrote:
> Shahab> target_desc *tdesc = arc_create_target_description (features);
>
> Shahab> - /* Add the newly created target description to the repertoire. */
> Shahab> - arc_tdesc_cache.emplace (features, tdesc);
> Shahab> + /* Add the newly created target description to the repertoire.
> Shahab> + PR build/27385: Use "target_desc_up ()" ctor explicitly. */
> Shahab> + arc_tdesc_cache.emplace (features, target_desc_up (tdesc));
>
> Shahab> return tdesc;
>
> I was going to suggest that arc_create_target_description return a
> target_desc_up, but when I look at the code, I see it already does, and
> that this line is different:
>
> arc_tdesc_cache.emplace (features, std::move (tdesc));
>
> So I suspect this is already fixed.

It is fixed in the trunk [1][2]. However, those are big patches.
I think it is better (safer?) to keep the fix small like the one
for RISCV [3].

Cheers,
Shahab

[1] gdb: Have allocate_target_description return a unique_ptr
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=51a948fdf0e

[2] gdb: Delay releasing target_desc_up in more cases
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bbb826f5e92

[3] [gdb/build] Fix missing implicit constructor call with gcc 4.8