From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12595 invoked by alias); 13 Nov 2013 07:33:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12574 invoked by uid 48); 13 Nov 2013 07:33:25 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59104] New: Wrong result with SIZE specification expression Date: Wed, 13 Nov 2013 07:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg01196.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59104 Bug ID: 59104 Summary: Wrong result with SIZE specification expression Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org James Van Buskirk found the following problem, https://groups.google.com/forum/#!topic/comp.lang.fortran/2RleGXz6-ew Result with GCC 4.8 + 4.9: size(f) = 1 size(y) = 2143476561 Result with GCC 4.5, 4.6 and 4.7: size(f) = 1 size(y) = 1 Expected result: size(f) = 1 size(y) = 2 module m1 implicit none integer, parameter :: dp = kind([double precision::]) contains recursive function f(x) integer, intent(in) :: x real(dp) f(x/2) integer y(size(f)+1) write(*,*) 'size(f) = ',size(f) write(*,*) 'size(y) = ',size(y) f = 0 end function f end module m1 program bug3 use m1 implicit none real y y = sum(f(2)) end program bug3