Path: utzoo!utgpu!watmath!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!APOLLO.COM!mike From: mike@APOLLO.COM Newsgroups: gnu.gcc.bug Subject: GCC bug concerning volatile Message-ID: <8909201748.AA10157@xuucp.ch.apollo.com> Date: 20 Sep 89 17:53:52 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 39 The following simple C program shows a bug in gcc version 1.35 code generation : volatile struct foo { char a, b, c; }; tst() { struct foo *foo; foo = (struct foo *) 1234; foo->a = foo->c; foo->a = foo->c; foo->a = foo->c; } The assembly output (68K) is : #NO_APP gcc_compiled.: .text .even .globl tst tst: link a6,#0 movew #1234,a0 moveb 1236:w,a0@ unlk a6 rts Since the structure is marked as volatile the compiler should not be removing redundant assignments. A simple work around that I have been using is to mark the pointer itself as volatile (eg. volatile struct foo *foo; ). Mike Schloss mike@apollo.hp.com decvax!apollo!mike