delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/25/06:52:27

Date: Thu, 25 Jan 1996 13:42:38 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Cuthalion / Sliced Bread <enrico AT max DOT tiac DOT net>
Cc: djgpp AT delorie DOT com
Subject: Re: Waiting for retraces........................................

On Thu, 25 Jan 1996, Cuthalion / Sliced Bread wrote:

> 	Eventually I figured out what was wrong, after making a couple of 
> really stupid mistakes (I tried a whole bunch of times, it stands to 
> reason that some of the attempts will be really messed up.. :)   The 
> problem was that I was using -O3.  Evidently, GCC took this to mean that 
> I didn't expect the values of any hardware ports to change ever, and it 
> was okay if it would cache them.  Is this a problem with GCC in general, 
> or the port to the Intel chips?  (Can't it be told that some stuff, like 
> hardware status, will change, without GCC changing it?)

The PC motherboard chipset is built in a way that prevents the CPU from
caching memory-mapped peripheral devices and I/O ports, so it cannot be a
caching problem.  It might be that GCC has optimized out your code where
you read the ports.  Usually, the way to tell it not to do this is to
declare the variable `volatile'.  You didn't tell enough details to help
you more.  For instance, what version of DJGPP are you using? did you use
inport/outport library functions? can you post some code fragments where
this happens? 

One thing that you should know is that -O3 inlines functions which were 
declared inline.  So if you, for example, are using inport/outport 
function, it might be a problem with the way they are written or with the 
way you use them (depends on your version of DJGPP and the actual code of 
your program).

- Raw text -


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