aboutsummaryrefslogtreecommitdiff
path: root/gcc/df-scan.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-06-13 14:00:12 -0400
committerJason Merrill <jason@redhat.com>2021-06-21 10:50:01 -0400
commit7232f7c4c2d727431096a7ecfcf4ad4db71dcf2a (patch)
tree2705e5c36221bf19624c09c493ee9bd193a4cc94 /gcc/df-scan.c
parent12bdd39755a25d237b7776153cbe03e171396fc5 (diff)
downloadgcc-7232f7c4c2d727431096a7ecfcf4ad4db71dcf2a.zip
gcc-7232f7c4c2d727431096a7ecfcf4ad4db71dcf2a.tar.gz
gcc-7232f7c4c2d727431096a7ecfcf4ad4db71dcf2a.tar.bz2
expand: empty class return optimization [PR88529]
The x86_64 psABI says that an empty class isn't passed or returned in memory or registers, so we shouldn't set %eax in this function. The df-scan hunk catches the case where we look at a 0-length reg and build a range the length of unsigned int, which happened before I changed assign_parms to match expand_function_end. PR target/88529 gcc/ChangeLog: * df-scan.c (df_ref_record): Check that regno < endregno. * function.c (assign_parms, expand_function_end): Do nothing with a TYPE_EMPTY_P result. gcc/testsuite/ChangeLog: * g++.target/i386/empty-class1.C: New test.
Diffstat (limited to 'gcc/df-scan.c')
-rw-r--r--gcc/df-scan.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 1268536..e9da64f 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2595,6 +2595,8 @@ df_ref_record (enum df_ref_class cl,
ref_flags |= DF_REF_PARTIAL;
ref_flags |= DF_REF_MW_HARDREG;
+ gcc_assert (regno < endregno);
+
hardreg = problem_data->mw_reg_pool->allocate ();
hardreg->type = ref_type;
hardreg->flags = ref_flags;