This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/10423: -fvolatile switch not working in gcc 3.2-3 when using -O2


>Number:         10423
>Category:       optimization
>Synopsis:       -fvolatile switch not working in gcc 3.2-3 when using -O2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 16 17:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     dberger at motorola dot com
>Release:        3.2-3
>Organization:
>Environment:
Cygwin and Solaris, native and cross compilers
>Description:
Compile with following using "gcc -O2 -fvolatile -S":

void test(void)
{
  *(char *)0x100 = 1;
  *(char *)0x100 = 1;
  *(char *)0x100 = 1;
  *(char *)0x100 = 1;
}

The definition of -fvolatile should cause four writes to be generated - always.  With the 2.95 compiler that is what occurs.  With the 3.2-3 compiler, only one remains after optimization.   This is a serious problem for embedded, legacy programs.
>How-To-Repeat:

>Fix:
Is there a workaround?
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]