From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23547 invoked by alias); 16 Jun 2013 08:13:05 -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 23515 invoked by uid 48); 16 Jun 2013 08:13:00 -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:13: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/msg00829.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57628 --- Comment #3 from Ryo Furue --- (In reply to kargl from comment #1) Thank you for the prompt response! [This is a re-post. I missed the "reply" feature and made a typo. I would delete the other post, if possible.] > But, it is evaluated at compile time, and so, you'll > get the error. I understand that. > You are getting the correct diagnosis! Of course. I agree with all your statements. And your statements entirely miss the point! This is a "quality of implementation" issue. Since my code includes an expression that can be evaluated at compile time and it's a division by zero, the compiler has the right to treat it as error. (But, that's my guess. What does the standard say? The standard doesn't have the notion of "compile time", so I wonder how such a case as this is treated in the standard.) The question is "Is refusing to compile it the best way to deal with this error?" My answer is no. Since, real, parameter:: a = 0 If (a > 0) then write(*,*) 1/a !! this part end if the contents of the IF statement is unreachable, the compiler more appropriately would issue an "unreachable statements" warning and disregard the contents of the unreachable code. In my opinion. Cheers, Ryo