Bug 12590

Summary: inline asm impossible constraint in `asm'
Product: gcc Reporter: giffordj
Component: rtl-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 3.3.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: Preprocessed Source

Description giffordj 2003-10-12 18:03:35 UTC
Compiles fine with no -O, but gives impossible constraint in `asm' when 
compiled with -O2 or -O3.

Code

inline jlong atomic::compare_and_exchange_long(jlong exchange_value, jlong*
dest, jlong compare_value) {
  jlong old_value;
  __asm__ volatile (  "pushl %%ebx;mov 4+%1,%%ecx;mov
%1,%%ebx;lock;cmpxchg8b (%3);popl %%ebx"
                    : "=A" (old_value)
                    : "o" (exchange_value), "A" (compare_value), "r" (dest)
                    : "%ebx", "%ecx", "memory");
  return old_value;
}
Comment 1 Andrew Pinski 2003-10-15 02:06:13 UTC
We need a full test case, read <http://gcc.gnu.org/bugs.html>
Comment 2 giffordj 2003-10-15 16:14:32 UTC
Created attachment 4938 [details]
Preprocessed Source
Comment 3 giffordj 2003-10-15 16:15:06 UTC
Error Messages

/usr/src/java/hotspot/src/os_cpu/linux_i486/vm/atomic_linux_i486.inline.hpp: In
   function `jboolean JVM_CX8Field(JNIEnv*, _jobject*, _jfieldID*, long long
   int, long long int)':
/usr/src/java/hotspot/src/os_cpu/linux_i486/vm/atomic_linux_i486.inline.hpp:50:
 error: impossible
   constraint in `asm'
Comment 4 Andrew Pinski 2003-10-15 19:29:41 UTC
Marking invalid to mark it as ...
Comment 5 Andrew Pinski 2003-10-15 19:29:55 UTC
unconfirmed.
Comment 6 Andrew Pinski 2003-10-18 17:34:33 UTC
The problem is with the "o" constriant, if I change it to m (which looks better and is right 
constraint to use in this case because the memory location could be any where).