<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang fails to compile linux: invalid size for constraints (integrated-as)"
   href="https://bugs.llvm.org/show_bug.cgi?id=33587">33587</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang fails to compile linux: invalid size for constraints (integrated-as)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dima@golovin.in
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following errors are generated when compiling linux on x86 with clang with
integrated-as enabled: "invalid output size for constraint '=q'" and "invalid
input size for constraint 'qi'". These constraints are defined in macros
percpu_from_op and percpu_to_op from arch/x86/include/asm/percpu.h:

    asm(op "b %1,"__percpu_arg(0)
        : "+m" (var)
        : "qi" ((pto_T__)(val)));

    asm(op "b "__percpu_arg(1)",%0"
        : "=q" (pfo_ret__)
        : "m" (var));


Latest LLVM source and Linux source were used.

Example error when compiling arch/x86/kernel/cpu/intel.c:

arch/x86/kernel/cpu/intel.c:97:2: error: invalid input size for constraint 'qi'
        this_cpu_or(msr_misc_features_shadow,
        ^
./include/linux/percpu-defs.h:498:32: note: expanded from macro 'this_cpu_or'
#define this_cpu_or(pcp, val)           __pcpu_size_call(this_cpu_or_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:364:11: note: expanded from macro
'__pcpu_size_call'
                case 1: stem##1(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:263:1: note: expanded from here
this_cpu_or_1
^
./arch/x86/include/asm/percpu.h:425:34: note: expanded from macro
'this_cpu_or_1'
#define this_cpu_or_1(pcp, val)         percpu_to_op("or", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:97:2: error: invalid input size for constraint 'qi'
./include/linux/percpu-defs.h:498:32: note: expanded from macro 'this_cpu_or'
#define this_cpu_or(pcp, val)           __pcpu_size_call(this_cpu_or_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:365:11: note: expanded from macro
'__pcpu_size_call'
                case 2: stem##2(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:264:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:426:34: note: expanded from macro
'this_cpu_or_2'
#define this_cpu_or_2(pcp, val)         percpu_to_op("or", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:97:2: error: invalid input size for constraint 'qi'
./include/linux/percpu-defs.h:498:32: note: expanded from macro 'this_cpu_or'
#define this_cpu_or(pcp, val)           __pcpu_size_call(this_cpu_or_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:366:11: note: expanded from macro
'__pcpu_size_call'
                case 4: stem##4(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:264:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:427:34: note: expanded from macro
'this_cpu_or_4'
#define this_cpu_or_4(pcp, val)         percpu_to_op("or", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:505:2: error: invalid input size for constraint
'qi'
        this_cpu_write(msr_misc_features_shadow, 0);
        ^
./include/linux/percpu-defs.h:495:34: note: expanded from macro
'this_cpu_write'
#define this_cpu_write(pcp, val)        __pcpu_size_call(this_cpu_write_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:364:11: note: expanded from macro
'__pcpu_size_call'
                case 1: stem##1(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:61:1: note: expanded from here
this_cpu_write_1
^
./arch/x86/include/asm/percpu.h:416:36: note: expanded from macro
'this_cpu_write_1'
#define this_cpu_write_1(pcp, val)      percpu_to_op("mov", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:505:2: error: invalid input size for constraint
'qi'
./include/linux/percpu-defs.h:495:34: note: expanded from macro
'this_cpu_write'
#define this_cpu_write(pcp, val)        __pcpu_size_call(this_cpu_write_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:365:11: note: expanded from macro
'__pcpu_size_call'
                case 2: stem##2(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:62:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:417:36: note: expanded from macro
'this_cpu_write_2'
#define this_cpu_write_2(pcp, val)      percpu_to_op("mov", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:505:2: error: invalid input size for constraint
'qi'
./include/linux/percpu-defs.h:495:34: note: expanded from macro
'this_cpu_write'
#define this_cpu_write(pcp, val)        __pcpu_size_call(this_cpu_write_, pcp,
val)
                                        ^
./include/linux/percpu-defs.h:366:11: note: expanded from macro
'__pcpu_size_call'
                case 4: stem##4(variable, __VA_ARGS__);break;           \
                        ^
<scratch space>:62:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:418:36: note: expanded from macro
'this_cpu_write_4'
#define this_cpu_write_4(pcp, val)      percpu_to_op("mov", (pcp), val)
                                        ^
./arch/x86/include/asm/percpu.h:101:15: note: expanded from macro
'percpu_to_op'
                    : "qi" ((pto_T__)(val)));           \
                            ^
arch/x86/kernel/cpu/intel.c:511:8: error: invalid output size for constraint
'=q'
        msr = this_cpu_read(msr_misc_features_shadow);
              ^
./include/linux/percpu-defs.h:494:29: note: expanded from macro 'this_cpu_read'
#define this_cpu_read(pcp)              __pcpu_size_call_return(this_cpu_read_,
pcp)
                                        ^
./include/linux/percpu-defs.h:308:23: note: expanded from macro
'__pcpu_size_call_return'
        case 1: pscr_ret__ = stem##1(variable); break;                  \
                             ^
<scratch space>:62:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:413:31: note: expanded from macro
'this_cpu_read_1'
#define this_cpu_read_1(pcp)            percpu_from_op("mov", pcp)
                                        ^
./arch/x86/include/asm/percpu.h:188:15: note: expanded from macro
'percpu_from_op'
                    : "=q" (pfo_ret__)                  \
                            ^
arch/x86/kernel/cpu/intel.c:511:8: error: invalid output size for constraint
'=q'
./include/linux/percpu-defs.h:494:29: note: expanded from macro 'this_cpu_read'
#define this_cpu_read(pcp)              __pcpu_size_call_return(this_cpu_read_,
pcp)
                                        ^
./include/linux/percpu-defs.h:309:23: note: expanded from macro
'__pcpu_size_call_return'
        case 2: pscr_ret__ = stem##2(variable); break;                  \
                             ^
<scratch space>:62:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:414:31: note: expanded from macro
'this_cpu_read_2'
#define this_cpu_read_2(pcp)            percpu_from_op("mov", pcp)
                                        ^
./arch/x86/include/asm/percpu.h:188:15: note: expanded from macro
'percpu_from_op'
                    : "=q" (pfo_ret__)                  \
                            ^
arch/x86/kernel/cpu/intel.c:511:8: error: invalid output size for constraint
'=q'
./include/linux/percpu-defs.h:494:29: note: expanded from macro 'this_cpu_read'
#define this_cpu_read(pcp)              __pcpu_size_call_return(this_cpu_read_,
pcp)
                                        ^
./include/linux/percpu-defs.h:310:23: note: expanded from macro
'__pcpu_size_call_return'
        case 4: pscr_ret__ = stem##4(variable); break;                  \
                             ^
<scratch space>:62:1: note: expanded from here
"0"
^
./arch/x86/include/asm/percpu.h:415:31: note: expanded from macro
'this_cpu_read_4'
#define this_cpu_read_4(pcp)            percpu_from_op("mov", pcp)
                                        ^
./arch/x86/include/asm/percpu.h:188:15: note: expanded from macro
'percpu_from_op'
                    : "=q" (pfo_ret__)                  \
                            ^
9 errors generated.

This blocks the meta-<a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - [Meta] Compiling the Linux kernel with clang"
   href="show_bug.cgi?id=4068">bug 4068</a>.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>