You are not logged in.

#1 2009-03-31 14:28:08

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

GCC Help: optimize too much

Hi, i'm compiling the following code with gcc with this command:

gcc -c plc2c.c -o plc2c.o -Wa,-a
void plc2c(void)
{
   (*(unsigned short*)(*(unsigned long int*)(2818076))) = (*(unsigned short *)(*(unsigned long int*)(2818072))); 
   if
   (
      ((*(((unsigned short*)(*(unsigned long int*)(2818048)))+0) & 2 ) == 2)
   )
   {
      *(((unsigned short*)(*(unsigned long int*)(2818048)))+0) |= 1; 
   }

}

the assembly list is the follow:

  1                            .file   "plc2c.c"
  2                            .h8300s
  3                            .section .text
  4                            .align 1
  5                            .global _plc2c
  6                    _plc2c:
  7 0000 01006DF6              mov.l   er6,@-er7
  8 0004 0FF6                  mov.l   er7,er6
  9 0006 7A02002B              mov.l   #2818076,er2
  9      001C
 10 000c 01006922              mov.l   @er2,er2
 11 0010 0FA3                  mov.l   er2,er3
 12 0012 7A02002B              mov.l   #2818072,er2
 12      0018
 13 0018 01006922              mov.l   @er2,er2
 14 001c 6922                  mov.w   @er2,r2
 15 001e 69B2                  mov.w   r2,@er3
 16 0020 7A02002B              mov.l   #2818048,er2
 16      0000
 17 0026 01006922              mov.l   @er2,er2
 18 002a 6922                  mov.w   @er2,r2
 19 002c 79620002              and.w   #2,r2
 20 0030 0D22                  mov.w   r2,r2
 21 0032 4700                  beq     .L3
 22 0034 7A02002B              mov.l   #2818048,er2
 22      0000
 23 003a 01006922              mov.l   @er2,er2
 24 003e 0FA3                  mov.l   er2,er3
 25 0040 7A02002B              mov.l   #2818048,er2
 25      0000
 26 0046 01006922              mov.l   @er2,er2
 27 004a 6922                  mov.w   @er2,r2
 28 004c 700A                  bset    #0,r2l
 29 004e 69B2                  mov.w   r2,@er3
 30                    .L3:
 31 0050 01006D76              mov.l   @er7+,er6
 32 0054 5470                  rts
 33                            .size   _plc2c, .-_plc2c
 34                            .ident  "GCC: (GNU) 4.3-GNUH8_v0901"
 35                            .end

Is there a option argument to force gcc to doesn't generate a .L3 and forcing a "linear" compilation?
Thanks

Offline

Board footer

Powered by FluxBB