I'm getting the following errors at compile time in Cygwin using gcc, but I'm not sure what they mean. My program runs without problems. Do I need to change the names of these operations? I'm afraid to tweak anything since it's working.

42: Warning: translating to `fmulp'
53: Warning: translating to `faddp'
60: Warning: translating to `fmulp'


Here is a snippet that contains these lines:

"		fstpl			%0			\n"
"		movl			$1,%%eax	                                \n"
"positive:							                \n"
"//compute lg(n)					                                \n"
"		fldl			%1			\n"
"		fld1						\n"
"		fldl			%0			\n"
"		fyl2x						\n"
"		fmul						\n"
"//2^x=2^int(x)*2^frac(x)			                                                \n"
"		fld			%%st(0)			\n"
"		fld			%%st(0)			\n"
"//compute integer portion			                                                \n"
"		frndint						\n"
"		fxch						\n"
"//compute fractional portion		                                                                \n"
"		fsub		%%st(1),%%st(0)	                                \n"
"		f2xm1						\n"
"		fld1						\n"

Dani AI

Generated

Short answer: those warnings mean the assembler is quietly replacing the bare, no-operand x87 mnemonics with the “pop” forms (the ones that end in p). The GNU assembler emits a “translating to ...p” message when it maps a legacy no-operand FP instruction to its pop variant. ()

Why it matters: x87 has two styles of these instructions. The pop forms (for example faddp / fmulp) perform the arithmetic and then pop the FPU register stack; the non-pop two-operand forms do the operation without changing stack depth. Many assemblers treat the single-token/no-operand form as the pop variant (so fadd with no operands is commonly assembled as faddp ST(1),ST(0)), which is why gas warns and translates it. If you want the pop behavior, use the explicit *p mnemonic; if you do not, use the two-operand form so the stack is unchanged. (felixcloutier.com)

Practical guidance: confirm intent rather than ignore the warning. If you intended to consume one entry from the x87 stack, append p (as did) to make intent explicit and silence the warning. If you did not intend to pop, change to the two-operand form so the assembler does not change stack behavior. Use gcc -S or objdump -d to inspect the generated assembly and verify stack effects. For new code, prefer SSE scalar/vector FP (addsd/mulsd or addss/mulss) on modern x86-64 to avoid x87 stack complexity. ()

Solution: I added p to the end of fmul and fadd in my code and the warnings went away. I guess the program wanted to pop the stack. I'm not sure of the details, but there you go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.