* [PATCH] middle-end/102683 - fix .DEFERRED_INIT expansion
@ 2021-10-11 14:22 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-10-11 14:22 UTC (permalink / raw)
To: gcc-patches
This avoids using an integer type for which we don't have an
approprate mode when expanding .DEFERRED_INIT to a non-memory
entity.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Will push after it finished.
Richard.
2021-10-11 Richard Biener <rguenther@suse.de>
PR middle-end/102683
* internal-fn.c (expand_DEFERRED_INIT): Check for mode
availability before building an integer type for storage
purposes.
---
gcc/internal-fn.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 6bc256832f7..b3638192fb9 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -3074,7 +3074,9 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
tree init;
if (tree_fits_uhwi_p (var_size)
&& (init_type == AUTO_INIT_PATTERN
- || !is_gimple_reg_type (var_type)))
+ || !is_gimple_reg_type (var_type))
+ && int_mode_for_size (tree_to_uhwi (var_size) * BITS_PER_UNIT,
+ 0).exists ())
{
unsigned HOST_WIDE_INT total_bytes = tree_to_uhwi (var_size);
unsigned char *buf = (unsigned char *) xmalloc (total_bytes);
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-11 14:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 14:22 [PATCH] middle-end/102683 - fix .DEFERRED_INIT expansion Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).