From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,110e3250dd85d941 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: X := X; Compiler Warning? Date: Mon, 12 Apr 2010 12:27:33 -0400 Organization: The Wasteland Message-ID: References: NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:10939 Date: 2010-04-12T12:27:33-04:00 List-Id: In article , Warren wrote: > This weekend, I discovered a problem after some > effort in debugging. The culprit was something > stupid like this: > > Position_X : Line_Index := ... > begin > > loop > .. > Position_X := Position_X; -- whoops > .. > exit when ...; > end loop; > > Obviously, that should have been coded as: > > Position_X := Position_X + 1; > > As outlined here, it is trivial to spot. > > But with the longer variable names (in the original > code), I somehow missed it in amongst all of the > other statements. > > Now isn't this something that is normally reported > as a warning? I'm using gnat, so perhaps I need an > additional compiler option. Add "-gnatwXX" to your "-cargs" in gnatmake, where XX is among these For example, -gnatwr yields warning: useless assignment of "Position_X" to itself -- John B. Matthews trashgod at gmail dot com