home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:13140 comp.sys.sun.misc:4056
- Newsgroups: comp.lang.c,comp.sys.sun.misc
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!news.mr.med.ge.com!carl@aslmr-serv.med.ge.com
- From: carl@aslmr-serv.med.ge.com (Carl Crawford)
- Subject: sun cc optimization failure
- Message-ID: <1992Sep3.040401.16902@mr.med.ge.com>
- Sender: news@mr.med.ge.com
- Nntp-Posting-Host: aslmr-gate2
- Reply-To: carl@aslmr-serv.med.ge.com (Carl Crawford)
- Organization: GE Medical Systems, Milwaukee, WI
- Date: Thu, 3 Sep 92 04:04:01 GMT
- Lines: 20
-
-
- consider the following program:
-
- main() {
- int i,j,ax;
- ax = 0;
- for(i=0;i<3;i++){
- j = ax * i;
- puts("in for loop");
- }
- }
- when compiled with cc (sun os 4.1 on sparc 1+), the
- code runs thru the loop three times. when comiled with
- the -O flag it only runs once. hom come the optimization
- screws up the loop?
- --
- Carl R. Crawford Voice: 414-521-6572
- GE Medical Systems Fax: 414-521-6575
- P.O. Box 414, W-875 Internet: crawfordc@med.ge.com
- Milwaukee, WI 53201
-