delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/02/12:15:21

Date: Mon, 2 Feb 1998 19:08:08 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: SOLYOM Andras <solyom AT eik DOT bme DOT hu>
cc: djgpp AT delorie DOT com
Subject: Re: Compiler error! (and something about Virtual memory)
In-Reply-To: <199802012210.XAA01335@goliat.eik.bme.hu>
Message-ID: <Pine.SUN.3.91.980202190747.19322P-100000@is>
MIME-Version: 1.0

On Sun, 1 Feb 1998, SOLYOM Andras wrote:

>         fseek(fCC, sizeof(TFILEHEADER) + 
>                           newNewsRecord.lKeywords[i]*sizeof(TKEYRECORD), 0); 
>         fread(&kr, sizeof(TKEYRECORD), 1, fCC); 
> 
>         while(kr.lParent) 
>         {             /* get ordinal of record in ll */ 
>           ll = (kr.lParent - sizeof(TFILEHEADER)) / sizeof(TKEYRECORD) + 1; 
>           if(ll >= lMin && ll < lMax) 
>             SetBit(ll-lMin, l); 
>           fseek(fCC, kr.lParent, 0); 
>           fread(&kr, sizeof(TKEYRECORD), 1, fCC); 
>         } 
> .... 
> 
> When compiled with -O3 the first fread() has never been executed: it
> was missing from the code! Without -O3 it worked fine. I am using
> gcc 2.7.2.1.

I find this hard to believe.  Please post the shortest source that can
be compiled with -O3 and which exhibits this alleged bug.

You might be missing something in the code generated by GCC.  For
example, it could be that the optimized code jumps into the loop,
right before the call to `fread' near the end of the loop.  This is
semantically equivalent to your source, so it is a perfectly legal
optimization.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019