[llvm-bugs] [Bug 33587] New: clang fails to compile linux: invalid size for constraints (integrated-as)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 25 13:53:20 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33587

            Bug ID: 33587
           Summary: clang fails to compile linux: invalid size for
                    constraints (integrated-as)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dima at golovin.in
                CC: llvm-bugs at lists.llvm.org

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-bug 4068.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170625/9995059d/attachment-0001.html>


More information about the llvm-bugs mailing list