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:47:54 +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 #5 from Ryo Furue <furue at hawaii dot edu> ---
(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