I wrote an x86 specific program that uses inline assembler to set and unset the
alignment check bit in the EFLAGS register. In between setting and unsetting
the bit, I use more inline assembler to save the state of the EFLAGS register.
The problem is that I get different results depending on whether optimization is
turned on or not. Further inspection reveals that when optimization is turned
on, gcc decides to optimize out the chunk of inline assembler I use to verify
the AC bit was turned off. When optimization is disabled, the chunk of inline
assembler re-appears.
The Intel C compiler v8.1 on the same machine does not exhibit this problem.
--
Summary: Wrong code generated by gcc from inline assembler
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thalakan at technologist dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-portbld-freebsd5.1
GCC host triplet: i386-portbld-freebsd5.1
GCC target triplet: i386-portbld-freebsd5.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18450