ping

On Fri, Oct 16, 2015 at 2:51 PM, Akira Hatanaka <ahata...@gmail.com> wrote:

> ahatanak created this revision.
> ahatanak added a subscriber: cfe-commits.
>
> clang doesn't print a very user-friendly message when an invalid register
> is used for a global register variable:
>
> For example, when the following code is compiled,
>
> $ cat f1.c
> volatile register long long A asm ("rdi");
>
> void foo1() {
>   A = 1;
> }
>
> clang prints this error message:
>
> $ clang -c f1.c
> fatal error: error in backend: Invalid register name global variable
>
> The code fails to compile because "rdi" isn't a valid register for global
> register variables on x86 (rsp, rbp, esp, and ebp are the only registers
> that are currently valid), but the diagnostic doesn't give much detail on
> why it is an error or which line of the source code is not correct because
> the error is detected in the backend.
>
> This patch makes changes in Sema to catch this kind of error earlier. In
> addition, it errors out if the size of the register doesn't match the
> declared variable size.
>
> e.g., volatile register int B asm ("rbp");
>
> http://reviews.llvm.org/D13834
>
> Files:
>   include/clang/Basic/DiagnosticSemaKinds.td
>   include/clang/Basic/TargetInfo.h
>   lib/Basic/Targets.cpp
>   lib/Sema/SemaDecl.cpp
>   test/CodeGen/named_reg_global.c
>   test/OpenMP/atomic_capture_codegen.cpp
>   test/OpenMP/atomic_read_codegen.c
>   test/OpenMP/atomic_update_codegen.cpp
>   test/OpenMP/atomic_write_codegen.c
>   test/OpenMP/for_loop_messages.cpp
>   test/OpenMP/threadprivate_messages.cpp
>   test/Sema/asm.c
>   test/SemaCUDA/asm-constraints-mixed.cu
>
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to