public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18735] New: option -fvolatile-global will not effect in some case
@ 2004-11-30  9:28 takeo dot komiyama at freescale dot com
  2004-11-30 12:36 ` [Bug c/18735] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: takeo dot komiyama at freescale dot com @ 2004-11-30  9:28 UTC (permalink / raw)
  To: gcc-bugs

With above code

------------ code --------------------------------------------
int glob_a = 3;

int main () 
{
  volatile int a;

  glob_a = 1;

  if ( 1 == glob_a )  // Cause problem here
  { }                 // Empty if

  return 0;
}
---------------------------------------------------
When compiled with 

gcc  -fvolatile-global -S -o main.s

To treat glob_a as "volatile", but as a result, it show following 
assembly code
------- test section of assembly code -----------------------
00000000 <main>:
main():
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:5
   0:   94 21 ff e0     stwu    r1,-32(r1)
   4:   7c 08 02 a6     mflr    r0
   8:   93 e1 00 1c     stw     r31,28(r1)
   c:   90 01 00 24     stw     r0,36(r1)
  10:   7c 3f 0b 78     mr      r31,r1
  14:   48 00 00 01     bl      14 <main+0x14>
                        14: R_PPC_REL24 __eabi
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:8
  18:   3d 20 00 00     lis     r9,0
                        1a: R_PPC_ADDR16_HA     glob_a
  1c:   38 00 00 01     li      r0,1
  20:   90 09 00 00     stw     r0,0(r9)
                        22: R_PPC_ADDR16_LO     glob_a
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:13
  24:   38 00 00 00     li      r0,0
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:14
  28:   7c 03 03 78     mr      r3,r0
  2c:   81 61 00 00     lwz     r11,0(r1)
  30:   80 0b 00 04     lwz     r0,4(r11)
  34:   7c 08 03 a6     mtlr    r0
  38:   83 eb ff fc     lwz     r31,-4(r11)
  3c:   7d 61 5b 78     mr      r1,r11
  40:   4e 80 00 20     blr
-------------------------------------------------------------
It seems 

if ( 1 == glob_a )
    { }

is gone somewhere, When I set 

volatile int glob_a = 3;

gcc compile to 
-------- assembly code when set glob_a as volatile ------
00000000 <main>:
main():
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:5
   0:   94 21 ff e0     stwu    r1,-32(r1)
   4:   7c 08 02 a6     mflr    r0
   8:   93 e1 00 1c     stw     r31,28(r1)
   c:   90 01 00 24     stw     r0,36(r1)
  10:   7c 3f 0b 78     mr      r31,r1
  14:   48 00 00 01     bl      14 <main+0x14>
                        14: R_PPC_REL24 __eabi
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:8
  18:   3d 20 00 00     lis     r9,0
                        1a: R_PPC_ADDR16_HA     glob_a
  1c:   38 00 00 01     li      r0,1
  20:   90 09 00 00     stw     r0,0(r9)
                        22: R_PPC_ADDR16_LO     glob_a
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:10
  24:   3d 20 00 00     lis     r9,0
                        26: R_PPC_ADDR16_HA     glob_a
  28:   80 09 00 00     lwz     r0,0(r9)
                        2a: R_PPC_ADDR16_LO     glob_a
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:13
  2c:   38 00 00 00     li      r0,0
/proj/sve/working/komiyama/cpp_test/volatile_test1/main.cc:14
  30:   7c 03 03 78     mr      r3,r0
  34:   81 61 00 00     lwz     r11,0(r1)
  38:   80 0b 00 04     lwz     r0,4(r11)
  3c:   7c 08 03 a6     mtlr    r0
  40:   83 eb ff fc     lwz     r31,-4(r11)
  44:   7d 61 5b 78     mr      r1,r11
  48:   4e 80 00 20     blr
------------------------------------------------------------------

Envionment
 O.S : Linux ( kernel 2.4.20-30.7.legacy)
       Glibc  2.2.5

 GCC : 3.3.3 configured with cross compiler
        ( Host is linux, target is ppc-unkown-eabi)

       with 
         binutils ... 2.14
         newlib   ... 1.12

-- 
           Summary: option -fvolatile-global will not effect in some case
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: takeo dot komiyama at freescale dot com
                CC: gcc-bugs at gcc dot gnu dot org,takeo dot komiyama at
                    freescale dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18735


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/18735] option -fvolatile-global will not effect in some case
  2004-11-30  9:28 [Bug c/18735] New: option -fvolatile-global will not effect in some case takeo dot komiyama at freescale dot com
@ 2004-11-30 12:36 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-30 12:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-30 12:36 -------
This option was removed from gcc in 3.4.0 for this reason see: <http://gcc.gnu.org/gcc-3.4/
changes.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18735


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-30 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-30  9:28 [Bug c/18735] New: option -fvolatile-global will not effect in some case takeo dot komiyama at freescale dot com
2004-11-30 12:36 ` [Bug c/18735] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).