[PATCH] Improve error handling of x86 inline-asm constraint "=f"

Akira Hatanaka ahatanak at gmail.com
Thu Jul 17 16:42:57 PDT 2014


This patch makes the following changes to improve error handling of x86
inline-asm constraint '=f'. According to the following link, it is a
mistake to use the 'f' constraint for output operands.

https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

1. Override TargetLowering::ComputeConstraintToUse so that this error can
be detected during instruction selection. Currently, it's detected in the
x86 FP stackifier pass (X86FloatingPoint.cpp), which is a pass that is run
much later.

2. Terminate immediately after this error is detected. Currently, clang
continues compiling the program after seeing this error, because the
inline-asm diagnostic handler that is installed doesn't terminate upon
seeing this error. As an example of why this is bad, I attached a program
that exposes an internal error when compiled with clang. clang didn't stop
compiling until it hit a call to report_fatal_error.

*main.c:17:7: **error: **illegal "f" output constraint*

      ".intel_syntax\n"

*      ^*

*fatal error: *error in backend: Access past stack top!


<rdar://problem/17476689>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/1cca4396/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inlineasmerror1.patch
Type: application/octet-stream
Size: 4915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/1cca4396/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/1cca4396/attachment.c>


More information about the llvm-commits mailing list