This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/80645] FAIL: gfortran.dg/elemental_subroutine_3.f90 -O1 (test for excess errors)
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 11 Dec 2017 12:38:20 +0000
- Subject: [Bug fortran/80645] FAIL: gfortran.dg/elemental_subroutine_3.f90 -O1 (test for excess errors)
- Auto-submitted: auto-generated
- References: <bug-80645-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80645
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looking again for the issue in the original report (the comment#1 issue has
been fixed):
arg:0 <var_decl 0x7ffff7fee5a0 x type <array_type 0x7ffff69a4930>
addressable used static decl_0 BLK
/space/rguenther/src/svn/trunk2/gcc/testsuite/gfortran.dg/elemental_subroutine_3.f90:29:0
size <integer_cst 0x7ffff697d930 192> unit-size <integer_cst 0x7ffff699c588 24>
and we warn about
__builtin_memcpy (_153, &MEM[(void *)&x + 16B], 12)
with x having size 24 there's not 12 bytes at &x + 16. It is DSE3 first
having the size of 12 here:
<bb 18> [local count: 20817692]:
_95 = __builtin_malloc (16);
- __builtin_memcpy (_95, &x[3], 16);
+ _153 = _95 + 4;
+ __builtin_memcpy (_153, &MEM[(void *)&x + 16B], 12);
this is from the following code in .original:
parm.11.dtype = 297;
parm.11.dim[0].lbound = 0;
parm.11.dim[0].ubound = 3;
parm.11.dim[0].stride = -1;
parm.11.data = (void *) &x[3];
parm.11.offset = 0;
typedef struct mytype [4];
...
data.13 = (struct mytype *) _gfortran_internal_pack (&parm.11);
if ((struct mytype[0:] *) parm.11.data == data.13)
{
{
void * restrict D.2228;
D.2228 = (void * restrict) __builtin_malloc (16);
data.13 = (struct mytype *) D.2228;
(void) __builtin_memcpy ((void *) data.13, parm.11.data, 16);
}
}
atmp.12.data = (void * restrict) data.13;
atmp.12.offset = 0;
{
integer(kind=8) S.14;
S.14 = 0;
while (1)
{
if (S.14 > 3) goto L.5;
{
integer(kind=4) D.2230;
D.2230 = (*(integer(kind=4)[0:] *)
parm.10.data)[parm.10.dim[0].stride * NON_LVALUE_EXPR <S.14>];
myassign (&(*(struct mytype[4] * restrict) atmp.12.data)[S.14],
&x[(integer(kind=8)) D.2230 + -1]);
}
S.14 = S.14 + 1;
}
L.5:;
so we somehow allocate a temporary for the view on the LHS even though
it is packed in-place (and later unpacked again) but somehow miscalculate
the size of the required temporary. Possibly because of the negative
stride.
x(4:1:-1) = x((/1,3,2,4/))
-> gfortran wrong-code bug. The reduced testcase from comment#10 does _not_
do this pack/unpack and temporary dance. Probably requires the myassign thing?
Fortran folks, please investigate again!