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/34656] modifies do loop variable



------- Comment #2 from jv244 at cam dot ac dot uk  2008-01-04 07:02 -------
(In reply to comment #1)
> This is almost impossible to diagnose.  Do you know of any compiler that
> detects this?

I think that lahey detects this at runtime. Almost all compilers detect the
simple case of directly (i.e. not through a call) modifing the variable. I
think it is actually a rather useful warning/error since it is an easy mistake
to make.

> 
> The only way I see to diagnose this, is to mark all do loop variables as such,
> and warn about all assignments to such variables in contained functions.  
> which also seems undesirable... Thoughts?
> 

I don't think this would be good enough without the extra check that this
contained function is called from within the corresponding loop. In principle
all information is available in this case, but I guess it might be difficult to
extract.


-- 


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


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