Ticket #1466 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

FASTDIV macro incorrect for constant propogation

Reported by: yang Owned by: michael
Priority: normal Component: avutil
Version: git-master Keywords: FASTDIV
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
In file libavutil/x86/intmath.h, around line 30
"g"(ff_inverse[b])\
In above line, "g" need be replaced by "rm".
Otherwise, if "ff_inverse[b]" is a constant and propogate to "mull" instruction by compiler optimization, the "mull" instruction will become a invalid instruction and the compilation will fail.

How to reproduce:
in folder libavutil/x86 folder, write a simple test case as following:
#include "intmath.h"
int main()
{

int ff_inverse[2]={1,2};
int x = 8;
int r = FASTDIV(x,0);
return r;

}

compile: gcc test.c -O2
test.c: Assembler messages:
test.c:7: Error: operand type mismatch for "mul"

The operand to the mul instruction can be either register or memory, not an immediate.

This bug will cause Intel C++ compiler compilation failed when IPO optimization is enabled.

Attachments

intmath.h.patch Download (339 bytes) - added by yang 11 months ago.
patch for libavutil/x86/intmatch.h

Change History

comment:1 follow-up: ↓ 2 Changed 11 months ago by cehoyos

  • Keywords FFMPEG mul type mismatch removed
  • Version changed from unspecified to git-master

Could you send a patch to ffmpeg-devel? It will create more attention there.

Changed 11 months ago by yang

patch for libavutil/x86/intmatch.h

comment:2 in reply to: ↑ 1 Changed 11 months ago by yang

Replying to cehoyos:

Could you send a patch to ffmpeg-devel? It will create more attention there.

how to send to ffmpeg-devel? I just attached a patch file here.

comment:3 Changed 11 months ago by cehoyos

Please update the patch, it does not apply anymore.

If you send the patch to the ffmpeg-devel mailing list - http://ffmpeg.org/mailman/listinfo/ffmpeg-devel - it will create more attention.

comment:4 Changed 11 months ago by michael

  • Status changed from new to closed
  • Resolution set to fixed

Patch updated and applied

thanks

Note: See TracTickets for help on using tickets.