From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1853 invoked by alias); 16 Jun 2013 08:47:58 -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 1808 invoked by uid 48); 16 Jun 2013 08:47:54 -0000 From: "furue at hawaii dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57628] spurious error: division by zero in if statement Date: Sun, 16 Jun 2013 08:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: furue at hawaii dot edu X-Bugzilla-Status: RESOLVED 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: Message-ID: In-Reply-To: References: 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-06/txt/msg00831.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57628 --- Comment #5 from Ryo Furue --- (In reply to Andrew Pinski from comment #4) > parameter are special in fortran. The expression is evaluated at compile > time because of the parameter. a has to be replaced with 0 according to the > fortran standard which is why you are getting this error. I understand that! And I've realized my mistake in saying "spurious" in the title of my submission. I apologize. But, my main point stands. There should be a compiler option (or something) that lets the code like my go. You could replace the expression "1.0/0.0" with an IEEE "Inf" and let the code go, couldn't you? As a quality of implementation issue, the current behavior of gfortran isn't ideal. Having said that, are you sure the standard states 1) that a parameter must be substituted at compile time? The standard doesn't have the notion of compile time. 2) that this code should be rejected by the compiler? I'm pretty sure that the standard doesn't say (2). The compiler states what is legal code and what is illegal. But it doesn't say what to do with an illegal code. Cheers, Ryo