This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/10423: -fvolatile switch not working in gcc 3.2-3 when using -O2
- From: dberger at motorola dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 16 Apr 2003 17:07:29 -0000
- Subject: optimization/10423: -fvolatile switch not working in gcc 3.2-3 when using -O2
- Reply-to: dberger at motorola dot com
>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: