On Thu, Jun 22, 2017 at 11:24:50PM +0300, Rémi Denis-Courmont wrote:
> On jeudi 22 juin 2017 21:12:00 EEST Diego Biurrun wrote:
> > On Wed, Jun 21, 2017 at 07:10:55PM +0300, Rémi Denis-Courmont wrote:
> > > Le keskiviikkona 21. kesäkuuta 2017, 18.07.05 EEST Diego Biurrun a écrit :
> > > > On Wed, Jun 21, 2017 at 07:05:45PM +0300, Rémi Denis-Courmont wrote:
> > > > > Le keskiviikkona 21. kesäkuuta 2017, 13.10.42 EEST Diego Biurrun a 
> écrit :
> > > > > > Some of the quant tables used by Bink are generated at runtime and
> > > > > > therefore not const while some others are stored in the binary and
> > > > > > therefore are const. read_dct_coeffs() takes a const pointer to a
> > > > > > quant
> > > > > > table as parameter, cast that parameter to const for the
> > > > > > runtime-generated tables.
> > > > > > 
> > > > > > libavcodec/bink.c:869:58: warning: passing argument 4 of
> > > > > > 'read_dct_coeffs'
> > > > > > from incompatible pointer type read_dct_coeffs(gb, dctblock,
> > > > > > bink_scan,
> > > > > > binkb_intra_quant, qp); libavcodec/bink.c:902:58: warning: passing
> > > > > > argument
> > > > > > 4 of 'read_dct_coeffs' from incompatible pointer type
> > > > > > read_dct_coeffs(gb,
> > > > > > dctblock, bink_scan, binkb_inter_quant, qp);
> > > > > 
> > > > > As the warning states, those typse are not compatible. Adding an
> > > > > explicit
> > > > > cast only hides the bug without fixing it. I wouldn´t do that.
> > > > 
> > > > What bug
> > > 
> > > What the warning says: incompatible types. In other words, type aliasing
> > > violation.
> > 
> > That is a potential bug at best. What disaster can happen if I cast the
> > pointer to the (read-only) array to const?
> 
> I don't have a crystal ball to tell me how badly the compilers of the future 
> will optimize this incorrect code, or not.

More general statements; what is the bug here? How do you suggest handling
the case of generated and stored tables being handled in the same function?

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to