RE: Simple Question on CPU specific Optimization Options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
-----Original Message-----
From: Hofman, Gertjan (BI35) 
Sent: Friday, August 24, 2007 5:13 PM
To: 'gcc-help@xxxxxxxxxxx'
Subject: Simple Question on CPU specific Optimization Options 


Dear GCC user,

I am hoping this is a simple how-to question.

I am programming an embedded at91sam9260 ATMEL ARM-920 processor, cross
compiling on Linux-i386. My program read/writes directly to memory after
getting pointers from the /dev/mem driver. i.e. using statements like:

    ctrl_reg= *((unsigned char *) virtaddr);  \\ a read
    *((unsigned char *) virtaddr) =  0xF0;    \\ a write

I have noticed that any optimization flag (-0 and up) removes
consequtive read/write lines i.e. 

  *((unsigned char *) virtaddr) =  0xF0;
  *((unsigned char *) virtaddr) =  0xFE;  

Even though they are writing different data to memory. Kind of scary.
With -O0, the code runs as anticipated.

In order to find out what is causing the removal I replaced -O with all
the -fxxxxx options listed in man gcc. This does not replicate the
problem ! In otherwords, -O does more that the sum of all the -fxxx
options.

1. Is there a way to have the compiler tell me which options are being
turned on using -O ?
2. Are there architecture specific optimizations which are not described
in the man page ?

Much appreciated

Gertjan





Gertjan Hofman, PhD
Principal Research Scientist
Honeywell Process Solutions
QCS & Sensors
Phone: 604.982.3574 (office) 604.980.3421 ext 4514 (lab)
Fax: 604.980.0120
500 Brooksbank Ave
North Vancouver, BC V7J 3S4
Canada


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux