Bug 40015 - [4.5.0 Regression] Revision 147083 failed gfortran.dg/array_memcpy_4.f90
Summary: [4.5.0 Regression] Revision 147083 failed gfortran.dg/array_memcpy_4.f90
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-04 03:41 UTC by H.J. Lu
Modified: 2009-05-04 12:43 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-05-04 09:25:57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2009-05-04 03:41:02 UTC
Revision 147083:

http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00057.html

triggered:

FAIL: gfortran.dg/array_memcpy_4.f90  -O  scan-tree-dump-times original "d = " 1
Comment 1 Hans-Peter Nilsson 2009-05-04 05:54:57 UTC
Seen for cris-elf too...
Comment 2 Dominique d'Humieres 2009-05-04 06:30:37 UTC
Confirmed on i686-apple-darwin9, array_memcpy_4.f90.003t.original is

MAIN__ ()
{
  struct t d[5];
  struct t s[5];
  static integer(kind=4) options.0[8] = {68, 255, 0, 0, 0, 1, 0, 1};

  _gfortran_set_options (8, (void *) &options.0);
  (void) __builtin_memcpy ((void *) &d, (void *) &s, 60);
}

and does not depend on the optimization level.
Comment 3 Dominique d'Humieres 2009-05-04 06:32:41 UTC
At revision 147065 I get:

MAIN__ ()
{
  struct t d[5];
  struct t s[5];
  static integer(kind=4) options.0[8] = {68, 255, 0, 0, 0, 1, 0, 1};

  _gfortran_set_options (8, (void *) &options.0);
  d = VIEW_CONVERT_EXPR<struct t[5]>(s);
}
Comment 4 Dominique d'Humieres 2009-05-04 08:59:03 UTC
This test has been introduced by the patch in http://gcc.gnu.org/ml/fortran/2007-01/msg00425.html.
The tests gfortran.dg/array_memcpy_[1-3].f90 use

! { dg-final { scan-tree-dump-times "memcpy" * "original" } }

So a simple fix would be to replace

! { dg-final { scan-tree-dump-times "d = " 1 "original" } }

with

! { dg-final { scan-tree-dump-times "memcpy" 1 "original" } }

but I don't understand why array_memcpy_4.f90 used to give a different construct and this change could mask a more serious problem.

Comment 5 rguenther@suse.de 2009-05-04 09:01:18 UTC
Subject: Re:  [4.5.0 Regression]  Revision 147083 failed
 gfortran.dg/array_memcpy_4.f90

On Mon, 4 May 2009, dominiq at lps dot ens dot fr wrote:

> ------- Comment #4 from dominiq at lps dot ens dot fr  2009-05-04 08:59 -------
> This test has been introduced by the patch in
> http://gcc.gnu.org/ml/fortran/2007-01/msg00425.html.
> The tests gfortran.dg/array_memcpy_[1-3].f90 use
> 
> ! { dg-final { scan-tree-dump-times "memcpy" * "original" } }
> 
> So a simple fix would be to replace
> 
> ! { dg-final { scan-tree-dump-times "d = " 1 "original" } }
> 
> with
> 
> ! { dg-final { scan-tree-dump-times "memcpy" 1 "original" } }
> 
> but I don't understand why array_memcpy_4.f90 used to give a different
> construct and this change could mask a more serious problem.

I will investigate - we really should get the memcpy removed.

Richard.
Comment 6 Richard Biener 2009-05-04 09:25:57 UTC
I have a patch.
Comment 7 Richard Biener 2009-05-04 11:02:17 UTC
Subject: Bug 40015

Author: rguenth
Date: Mon May  4 11:01:59 2009
New Revision: 147094

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147094
Log:
2009-05-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/40015
	* builtins.c (fold_builtin_memory_op): Do not decay to element
	type if the size matches the whole array.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c

Comment 8 Richard Biener 2009-05-04 12:43:25 UTC
Fixed.