Path: utzoo!mnetor!uunet!husc6!bbn!rochester!pt.cs.cmu.edu!IUS1.CS.CMU.EDU!edw From: edw@IUS1.CS.CMU.EDU (Eddie Wyatt) Newsgroups: comp.lang.c Subject: Re: volatiles Message-ID: <1412@pt.cs.cmu.edu> Date: 13 Apr 88 21:07:27 GMT References: <1394@pt.cs.cmu.edu> <1530@dataio.Data-IO.COM> Sender: netnews@pt.cs.cmu.edu Organization: Carnegie-Mellon University, CS/RI Lines: 21 > > Programs that run successfully when unoptimized and fail when optimized > suffer from one of the following: > (1) The optimizer has bugs. > (2) The program is incorrect, i.e. it is dependent on coincidental > or undefined behavior. And for the case of volatiles, it's my opinion that the optimization technique is buggy. It assumes that data flow analysis of the code can be used to conduct dead code elimination, variable induction, migration of loop invariants, etc. It can not when you have multi-threads of execution with shared variable because in general any of the shared variables may changed at any time. volatile is just a HACK to make the optimization technique work! volatile adds no additional expressive power to the language, neither is it adding convenience - it only tell the optimizer where it is about to goof up so the optimizer doesn't commit a blunder! -- Eddie Wyatt e-mail: edw@ius1.cs.cmu.edu