diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-01-17 13:54:44 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-01-17 13:54:44 +0100 |
commit | 2c74d5c0a0f21ae1d0c195ca0d81a3d1032f27e3 (patch) | |
tree | 384feec075d8640578b931b7aff0004c42882382 /gcc | |
parent | df0a668b784556fe4317317d58961652d93d53de (diff) | |
download | gcc-2c74d5c0a0f21ae1d0c195ca0d81a3d1032f27e3.zip gcc-2c74d5c0a0f21ae1d0c195ca0d81a3d1032f27e3.tar.gz gcc-2c74d5c0a0f21ae1d0c195ca0d81a3d1032f27e3.tar.bz2 |
ipa-strub: Fix handling of _BitInt returns [PR113406]
Seems pass_ipa_strub::execute contains a copy of the expand_thunk
code I've changed for _BitInt in r14-6805 PR112941 - larger _BitInts
are aggregate_value_p even when they are is_gimple_reg_type.
2024-01-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113406
* ipa-strub.cc (pass_ipa_strub::execute): Check aggregate_value_p
regardless of whether is_gimple_reg_type (restype) or not.
* gcc.dg/bitint-70.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ipa-strub.cc | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/bitint-70.c | 14 |
2 files changed, 21 insertions, 12 deletions
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index a3c5318..e1b0701 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -3174,21 +3174,16 @@ pass_ipa_strub::execute (function *) resdecl, build_int_cst (TREE_TYPE (resdecl), 0)); } - else if (!is_gimple_reg_type (restype)) + else if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) { - if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) + restmp = resdecl; + + if (VAR_P (restmp)) { - restmp = resdecl; - - if (VAR_P (restmp)) - { - add_local_decl (cfun, restmp); - BLOCK_VARS (DECL_INITIAL (current_function_decl)) - = restmp; - } + add_local_decl (cfun, restmp); + BLOCK_VARS (DECL_INITIAL (current_function_decl)) + = restmp; } - else - restmp = create_tmp_var (restype, "retval"); } else restmp = create_tmp_reg (restype, "retval"); diff --git a/gcc/testsuite/gcc.dg/bitint-70.c b/gcc/testsuite/gcc.dg/bitint-70.c new file mode 100644 index 0000000..3970553 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-70.c @@ -0,0 +1,14 @@ +/* PR middle-end/113406 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c23 -fstrub=internal" } */ +/* { dg-require-effective-target strub } */ + +#if __BITINT_MAXWIDTH__ >= 146 +_BitInt(146) +#else +_BitInt(16) +#endif +foo (void) +{ + return 0; +} |