This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57628] spurious error: division by zero in if statement
- From: "furue at hawaii dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 16 Jun 2013 08:12:59 +0000
- Subject: [Bug fortran/57628] spurious error: division by zero in if statement
- Auto-submitted: auto-generated
- References: <bug-57628-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57628
--- Comment #3 from Ryo Furue <furue at hawaii dot edu> ---
(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