This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/30146] Redefining do-variable in excecution cycle



------- Comment #4 from burnus at gcc dot gnu dot org  2007-03-21 19:07 -------
(In reply to comment #3)
> The following program causes an infinite loop in gfortran, but not in other
> fortrans.

The program is plainly invalid as one redefines the DO thus your Fortran
compiler is free to do what ever it wants. In addition, your standard violation
cannot be detected at compile time.

gfortran implements it as:
  while(1) {
   if(i == 1) break;
  }
This of cause fails if you change i. As the program is invalid and as I don't
see any possibility to fix this in gfortran, I regard the problem of comment 3
as INVALID/WONTFIX.

For the original example, comment 0, I still think outputting a warning or an
error would be ok. (difference: the original example uses "INTENT(OUT)", the
comment 3 example uses no INTENT - besides, an interface or a host/use
association would be needed too.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30146


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]