From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31657 invoked by alias); 15 Apr 2005 17:25:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31428 invoked by uid 48); 15 Apr 2005 17:24:58 -0000 Date: Fri, 15 Apr 2005 17:25:00 -0000 Message-ID: <20050415172458.31426.qmail@sourceware.org> From: "tkoenig at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041115053618.18495.paulthomas2@wanadoo.fr> References: <20041115053618.18495.paulthomas2@wanadoo.fr> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libfortran/18495] Intrinisc function SPREAD is broken X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg02086.txt.bz2 List-Id: ------- Additional Comments From tkoenig at gcc dot gnu dot org 2005-04-15 17:24 ------- There's something rotten in the state of Denmark. I've slightly modified Paul's test program with my patch, and this is what I got: program test_spread implicit none integer, parameter :: N = 100 integer :: I integer, dimension(N) :: source integer, dimension(N,N) :: sink, check,c1,c2 source =(/(i, i=1,N)/) check = spread( source , 1 , N ) PRINT *,"first 4x4 elements with DIM=1" write(*,'(1x,4I4)') check(1:4,1:4) check = spread( source , 2 , N ) PRINT *,"first 4x4 elements with DIM=2" write(*,'(1x,4I4)') check(1:4,1:4) c1 = spread(source, 1, N) c2 = spread(source, 2, N) sink = spread( source , 1 , N ) * spread( source , 2 , N ) PRINT *,"The product using temporaries" write(*,'(1x,4I4)') sink(1:4,1:4) PRINT *,"The product using fixed arrays" sink = c1 * c2 write(*,'(1x,4I4)') sink(1:4,1:4) end program test_spread $ gfortran test_spread.f90 $ ./a.out first 4x4 elements with DIM=1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 first 4x4 elements with DIM=2 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 The product using temporaries 100 0 0 0 200 0 0 0 300 0 0 0 400 0 0 0 The product using fixed arrays 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 I am not applying my patch for the moment. A segfault is better than a silently generated wrong result :-( Investigating further. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18495