optimization/10423: -fvolatile switch not working in gcc 3.2-3 when using -O2
dberger@motorola.com
dberger@motorola.com
Wed Apr 16 17:16:00 GMT 2003
>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@motorola.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:
More information about the Gcc-prs
mailing list