On Tue, 16 Jun 2020, Richard Biener wrote: > > [the following fixes fallout of the last change which introduced > an assert - after this change we can likely trim down the set > of tree codes we "ignore"] > > The following avoids calling set_mem_attributes on the > DECL_INITIAL of a CONST_DECL which seems pointless since there > cannot be a sensible MEM_EXPR derived from that. We're overwriting > both other possibly useful info, alias-set and alignment immediately > so the following patch simply removes the call instead of making > the function deal with even more (unexpected) trees that are not > memory accesses. > > Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu.
All went well and I pushed this to master. Richard. > Richard. > > 2020-06-16 Richard Biener <rguent...@suse.de> > > PR middle-end/95690 > * varasm.c (build_constant_desc): Remove set_mem_attributes call. > > * gfortran.dg/pr95690.f90: New testcase. > --- > gcc/testsuite/gfortran.dg/pr95690.f90 | 9 +++++++++ > gcc/varasm.c | 1 - > 2 files changed, 9 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gfortran.dg/pr95690.f90 > > diff --git a/gcc/testsuite/gfortran.dg/pr95690.f90 > b/gcc/testsuite/gfortran.dg/pr95690.f90 > new file mode 100644 > index 00000000000..2da08912a4d > --- /dev/null > +++ b/gcc/testsuite/gfortran.dg/pr95690.f90 > @@ -0,0 +1,9 @@ > +! { dg-do compile } > +module m > +contains > + subroutine s > + print *, (erfc) ! { dg-error "not a floating constant" } > + end > + function erfc() > + end > +end > diff --git a/gcc/varasm.c b/gcc/varasm.c > index f062e48071f..4070f9c17e8 100644 > --- a/gcc/varasm.c > +++ b/gcc/varasm.c > @@ -3399,7 +3399,6 @@ build_constant_desc (tree exp) > TREE_CONSTANT_POOL_ADDRESS_P (symbol) = 1; > > rtl = gen_const_mem (TYPE_MODE (TREE_TYPE (exp)), symbol); > - set_mem_attributes (rtl, exp, 1); > set_mem_alias_set (rtl, 0); > > /* Putting EXP into the literal pool might have imposed a different > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)