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]

c++/1760: inline asm: "=m" output doesn't force operand in memory



>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:

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