[LLVMbugs] [Bug 6930] clang: invalid input constraint "p" in asm

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 6 02:59:55 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6930

Roberto Bagnara <bagnara at cs.unipr.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |bagnara at cs.unipr.it
         Resolution|FIXED                       |

--- Comment #6 from Roberto Bagnara <bagnara at cs.unipr.it> 2010-08-06 04:59:54 CDT ---
Here is a testcase coming from Linux 2.6.35:

$ cat /tmp/bug2.c

struct task_struct;

extern __typeof__(struct task_struct *) current_task;

struct task_struct *get_current(void)
{
  struct task_struct *pfo_ret__ = 0;
  switch (sizeof(current_task)) {
  case 1:
    asm("mov" "b ""%%""gs"":%P" "1"",%0" : "=q" (pfo_ret__) : "p"
(&(current_task)));
    break;
  case 2:
    asm("mov" "w ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p"
(&(current_task)));
    break;
  case 4:
    asm("mov" "l ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p"
(&(current_task)));
    break;
  case 8:
    asm("mov" "q ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p"
(&(current_task)));
    break;
  default:
    break;
  }
  return pfo_ret__;
}
$ ~/llvm.debug/Debug+Asserts/bin/clang /tmp/bug2.c 
/tmp/bug2.c:11:63: error: invalid input constraint 'p' in asm
    asm("mov" "b ""%%""gs"":%P" "1"",%0" : "=q" (pfo_ret__) : "p" ...
                                                              ^
/tmp/bug2.c:14:63: error: invalid input constraint 'p' in asm
    asm("mov" "w ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p" ...
                                                              ^
/tmp/bug2.c:17:63: error: invalid input constraint 'p' in asm
    asm("mov" "l ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p" ...
                                                              ^
/tmp/bug2.c:20:63: error: invalid input constraint 'p' in asm
    asm("mov" "q ""%%""gs"":%P" "1"",%0" : "=r" (pfo_ret__) : "p" ...
                                                              ^
4 errors generated.
$ ~/llvm.debug/Debug+Asserts/bin/clang --version  
clang version 2.8 (trunk 110191)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list