On Tue, 2 Nov 2021, Qing Zhao wrote: > Hi, > > PR103033 (c-c++-common/auto-init-4.c ICEs starting with r12-4829) > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103033 > > Is an -ftrivial-auto-var-init bug exposed on Powerpc64-linux only. > > For the following code in gcc/internal-fn.c: > > 3085 if (can_native_interpret_type_p (var_type)) > 3086 init = native_interpret_expr (var_type, buf, total_bytes); > ... > 3105 expand_assignment (lhs, init, false); > > there is an inconsistency between "can_native_interpret_type_p" and > "native_interpret_expr" for "long double" on Powerpcle: > although "can_native_interpre_type_p(long double)" return true, > "native_interpret_expr (long double, buf,...) return NULL on Powerpcle > Due to the fix for PR95450. > > Therefore, we should expect that “native_interpret_expr” might return NULL, > and under such situation, fall though to the more conservative path to > generate “init” > > The fix is very simple, and bootstrapped on x86, aarch64, and powerpc. > Regression testing are ongoing. > > Okay for trunk?
I'm testing a change to completely elide the native_interpret_expr path. We've assured an integer mode of the required size exists and doing an init from an integer is more natural and less prone to for example raise spurious FP exceptions. What remains to be done is to directly generate RTL for this case rather than going through expand_assignment, we'd want to generate a (set (subreg:IntMode (reg:X ...) ..) (const_int ...)) when possible. With the recent fix to not wrap an SSA LHS inside a VIEW_CONVERT_EXPR that became less likely. > Qing > > ===== > From 22cf4fee8cf4b050ab41a3de074db70359421b23 Mon Sep 17 00:00:00 2001 > From: Qing Zhao <qing.z...@oracle.com> > Date: Tue, 2 Nov 2021 22:28:13 +0000 > Subject: [PATCH] PR 103033 (c-c++-common/auto-init-4.c ICEs starting with > r12-4829) > > Fall through more conservative path to generate patten when > native_interpret_expr return NULL. > > gcc/ChangeLog: > > 2021-11-02 qing zhao <qing.z...@oracle.com> > > * internal-fn.c (expand_DEFERRED_INIT): Handle the case when > native_interpret_expr return NULL. > --- > gcc/internal-fn.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c > index fd6cb0995d9..0d056fdceea 100644 > --- a/gcc/internal-fn.c > +++ b/gcc/internal-fn.c > @@ -3082,9 +3082,8 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt) > unsigned char *buf = (unsigned char *) xmalloc (total_bytes); > memset (buf, (init_type == AUTO_INIT_PATTERN > ? INIT_PATTERN_VALUE : 0), total_bytes); > - if (can_native_interpret_type_p (var_type)) > - init = native_interpret_expr (var_type, buf, total_bytes); > - else > + if (!(can_native_interpret_type_p (var_type) > + && (init = native_interpret_expr (var_type, buf, total_bytes)))) > { > tree itype = build_nonstandard_integer_type > (total_bytes * BITS_PER_UNIT, 1); > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)