d: Fix wrong code-gen when returning structs by value.
commitc201cd3be0d9ab887fafb0c33a9fc287c405c21c
authorIain Buclaw <ibuclaw@gdcproject.org>
Wed, 28 Jun 2023 16:30:31 +0000 (28 18:30 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 28 Jun 2023 18:08:58 +0000 (28 20:08 +0200)
treea82038c71ab2ada5777443258508eb46931b4c8d
parent9757e4440bd8755d327601a60a73d57d712583ed
d: Fix wrong code-gen when returning structs by value.

Since r13-1104, structs have have compute_record_mode called too early
on them, causing them to return differently depending on the order that
types are generated in, and whether there are forward references.

This patch moves the call to compute_record_mode into its own function,
and calls it after all fields have been given a size.

PR d/106977
PR target/110406

gcc/d/ChangeLog:

* types.cc (finish_aggregate_mode): New function.
(finish_incomplete_fields): Call finish_aggregate_mode.
(finish_aggregate_type): Replace call to compute_record_mode with
finish_aggregate_mode.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/pr110406.d: New test.
gcc/d/types.cc
gcc/testsuite/gdc.dg/torture/pr110406.d [new file with mode: 0644]