This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Wierd bug with volatile pointer expressions


Eric Doenges wrote:
> 
>[snip]
> 
Yes it's a known bug which hasn't been fixed yet. There is a work around cast
the expressions with volatile memory refs to void (note this only need to be
done within statement expressions)

	#define WIERD ({\
	   (void)(*((volatile short *)1000) |= 5);\
	   while (*((volatile short *)1000) != 5);\
	 })

> Without the 'volatile' keyword, the superflous move is not emitted.
> 
Yes it only occurs when volatile memory references appear within a statement
expression (i.e. ({...})).

> The error occurs on all Version of gcc-2.95.2 availible to me, i.e. native
> Compilers on i386-linux, alpha-dec-osf4.0f and sparc-sun-solaris2.8, as
> well as the m68k-coff cross compiler on i386-linux.
> --
Yes its target independent. 
> ________________________________________________________________________
> Dipl.-Ing. Eric Doenges                         http://www.rcs.ei.tum.de
> Institute for Real-Time Computer Systems (RCS)      fon +49-89-289-23590
> Technische Universitaet Muenchen, D-80290 Muenchen  fax +49-89-289-23555

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]