Bug or feature?

Peter Mueller pmueller@decrc.abb.de
Mon Nov 30 02:11:00 GMT 1998


Hello,
i'm using egcs for rtems application programming. I found an unexpected
behaviour during debugging. See below

Peter Mueller


The VERSION file reads:
"
 GCC      -  egcs-1.1b
 BINUTILS -  binutils-2.9.1
 NEWLIB   -  newlib-1.8.0
 TARGET   -  m68k-rtems
 INSTALL POINT -
/usr/local/egcs-1.1b-binutils-2.9.1-newlib-1.8.0/m68k-rtems

 Patches may be installed "

------ test.c -----
/* Assumed Bug with "volatile" in egcs-2.91.57

   gcc-x86 always o.k.
   gcc-m68k -S -c -O3 test.c  o.k.
   gcc-m68k -S -c test.c      bug as below

 */

#define SCDR            (volatile unsigned short int *)(0x0e + 0xfffc00)

#define SCDR_novolatile (         unsigned short int *)(0x0e + 0xfffc00)

void test1(void) { int i; *SCDR            = i; }     /* bad   */
void test2(void) { int i; *SCDR            = 1234; }  /* good  */
void test3(void) { int i; *SCDR_novolatile = i; }     /* good  */
void test4(void) { int i; *SCDR_novolatile = 1234; }  /* good  */
------ end of file test.c -----

------ test.s ------
 .file "test.c"
gcc2_compiled.:
__gnu_compiled_c:
.text
 .even
.globl test1
test1:
 link.w %a6,#-4
 move.w -2(%a6),16776206
 move.w 16776206,16776206   ; !!! this line is not supposed to be here !

.L1:
 unlk %a6
 rts
 .even
.globl test2
test2:
 link.w %a6,#-4
 move.w #1234,16776206
.L2:
 unlk %a6
 rts
 .even
.globl test3
test3:
 link.w %a6,#-4
 move.w -2(%a6),16776206
.L3:
 unlk %a6
 rts
 .even
.globl test4
test4:
 link.w %a6,#-4
 move.w #1234,16776206
.L4:
 unlk %a6
 rts
----- end of file test.s -----




More information about the Gcc-bugs mailing list