Bug #759

undefined behaviour warning in ijg JPEG code

Added by Marco Eichelberg 4 months ago.

Status:New Start date:2017-06-21
Priority:Normal Due date:
Assignee:- % Done:


Target version:3.6.3
Module:dcmjpeg Compiler:
Operating System:


The warning is reported by gcc with option -Waggressive-loop-optimizations and seems to only affect the 16-bit version of the JPEG codec:

libijg16/jccolor.c:118:65: warning: iteration 65535u invokes undefined behavior [-Waggressive-loop-optimizations]

     rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i    + CBCR_OFFSET + ONE_HALF-1;
libijg16/jdmerge.c:108:38: warning: iteration 9396u invokes undefined behavior [-Waggressive-loop-optimizations]

             RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);

Also available in: Atom PDF