From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17794 invoked by alias); 4 Jan 2008 07:03:22 -0000 Received: (qmail 17642 invoked by uid 48); 4 Jan 2008 07:02:37 -0000 Date: Fri, 04 Jan 2008 07:17:00 -0000 Message-ID: <20080104070237.17641.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/34656] modifies do loop variable In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jv244 at cam dot ac dot uk" 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 X-SW-Source: 2008-01/txt/msg00282.txt.bz2 ------- 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