This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1760: inline asm: "=m" output doesn't force operand in memory
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1760: inline asm: "=m" output doesn't force operand in memory
- From: mattias at virtutech dot se
- Date: 24 Jan 2001 17:12:17 -0000
- Cc: gustav at virtutech dot se
- Reply-To: mattias at virtutech dot se
>Number: 1760
>Category: c++
>Synopsis: inline asm: "=m" output doesn't force operand in memory
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jan 24 09:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Mattias Engdegård
>Release: g++ version 2.97 20010120 (experimental), generating code for x86 on x86
>Organization:
>Environment:
linux 2.2, glibc 2.1.3
>Description:
Specifying an output operand as "=m" does not seem to force
the operand to be in memory. The code below results in the
errors
urk.c:6: output number 0 not directly addressable
urk.c:6: inconsistent operand constraints in an `asm'
when compiled with g++ -O2 :
typedef unsigned long long uint64;
uint64 fstps(void)
{
uint64 ret;
asm volatile("fstps %0" : "=m" (ret));
return ret;
}
Compiling with gcc instead of g++, removing -O2, or declaring
'ret' as volatile are workarounds.
>How-To-Repeat:
Compile with g++ -O2 :
typedef unsigned long long uint64;
uint64 fstps(void)
{
uint64 ret;
asm volatile("fstps %0" : "=m" (ret));
return ret;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: