Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

inline assembly warnings are treated as errors #9346

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR8984
Status NEW
Importance P normal
Reported by Charles Davis (cdavis5x@gmail.com)
Reported on 2011-01-16 12:47:19 -0800
Last modified on 2013-05-17 11:29:05 -0700
Version trunk
Hardware PC All
CC arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
A simple test case with this unimplemented CFI directive:

$ cat inline-asm.c

asm(".cfi_adjust_cfa_offset 4\n\t");

produces this:

$ clang -c inline-asm.c
<inline asm>:1:1: error: warning: ignoring directive for now
.cfi_adjust_cfa_offset 4
^
1 error generated.

It's clearly a warning, yet clang reports it as an error. Aside from the
obvious point that someone needs to finish up CFI support, I don't think that
warnings should be reported as errors unless -Werror gets passed to the
compiler.
Quuxplusone commented 11 years ago
Updating the test case as the original one seems (to me at least) to trigger a
real error now.

$ cat inline-asm.c

void t(){
  asm("movl (%rax,4), %eax");
}

$ clang -c inline-asm.c
inline-asm.c:6:7: error: scale factor without index register is ignored
  asm("movl     (%rax,4), %eax");
      ^
<inline asm>:1:13: note: instantiated into assembly here
        movl    (%rax,4), %eax
                      ^
1 error generated.

but in lib/Target/X86/AsmParser/X86AsmParser.cpp,
X86AsmParser::ParseMemOperand, this is defined as:

Warning(Loc, "scale factor without index register is ignored"));

and neither -Werror nor "fatal-assembler-warnings" are in use.