From: Andi Kleen <a...@gcc.gnu.org> Correct the description of inline assembler to say that gcc does limited assembler parsing to estimate the length of inline assembler statements, and document that certain assembler primitives can confuse it.
gcc/ChangeLog: * doc/extend.texi: Document assembler parsing heuristics. --- gcc/doc/extend.texi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b0bb0d47230..4c7c9120863 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -10911,9 +10911,16 @@ of an asm}). @item AssemblerInstructions This is a literal string that specifies the assembler code. The string can contain any instructions recognized by the assembler, including directives. -GCC does not parse the assembler instructions themselves and + +GCC only does minimal parsing of the assembler instructions to determine +how many there are for an conservative estimate of the maximum size of +the assembler statement for some optimizations, but otherwise does not know what they mean or even whether they are valid assembler input. +Assembler primitives that change the number of instructions like @code{.rept} or +expanding @code{.macro} macros might confuse these heuristics and should +be avoided inside functions. For top level assembler they are generally fine. + You may place multiple assembler instructions together in a single @code{asm} string, separated by the characters normally used in assembly code for the system. A combination that works in most places is a newline to break the -- 2.47.1