False positive for A4711 (Argument out of range)

Issue #129 new
Former user created an issue

I have the following lines of code (simplified):

type TRIFFWave = packed record ChunkID: array[0..3] of char; ChunkSize, Format: LongWord; Subchunk1ID: array[0..3] of char; Subchunk1Size: LongWord; AudioFormat, NumChannels: Word; SampleRate, ByteRate: LongWord; BlockAlign, BitsPerSample: Word; Subchunk2ID: array[0..3] of char; Subchunk2Size: LongWord; end;

var SampleOffset: Int16; SampleDivisor: Byte;

(...)

SampleDivisor := WaveHeader.BitsPerSample; SampleOffset := Int16((2 ** SampleDivisor) div 2);

The checker not complains that BitsPerSample(?) would be out of range, but actually putting a wavy line under the "2" (see attached image). IMHO this does not make sense and the Lazarus IDE does not complain here.

Comments (0)

  1. Log in to comment