delorie.com/archives/browse.cgi | search |
From: | "Marp" <Marp AT 0 DOT 0 DOT 0 DOT 0> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Compiler optimization bug |
Date: | Sun, 12 Dec 1999 11:43:07 -0500 |
Organization: | MindSpring Enterprises |
Lines: | 39 |
Message-ID: | <830j66$is$1@nntp6.atl.mindspring.net> |
References: | <830aq2$68s$1 AT news-int DOT gatech DOT edu> |
NNTP-Posting-Host: | c7.b7.cf.30 |
X-Server-Date: | 12 Dec 1999 16:40:38 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Robert Ruehlmann <rr9 AT angband DOT org> wrote in message news:830aq2$68s$1 AT news-int DOT gatech DOT edu... > I think I've found a bug in the DJGPP compiler (gcc 2.95.2). When optimized > with -O2 the following small sample program goes into an infinite loop. > Debugging with gdb shows strange behaviour like modifications of the 'size' > variable. > > <-- cut here --> > static void bug(int size, int tries) try changing this line to this instead: static void bug(volatile int size, int tries) > { > int i; > int num = 0; > > while (num < size) > { > for (i = 1; i < tries; i++) num++; > } > } > > int main() > { > bug(5, 10); > return 0; > } > <-- cut here --> > > -- > Robert Ruehlmann ( rr9 AT angband DOT org ) > "Thangorodrim - The Angband Page" : http://thangorodrim.angband.org/ > Visit the #angband chat channel at Othernet (irc.othernet.org).
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |