On Sat, Jun 2, 2012 at 7:22 PM, Reinier Olislagers < [email protected]> wrote:
> Windows > Laz x86 bigide trunk r37483, FPC trunk r21457 > > After compilation, when starting Laz I get an error message > TButtonGlyphs.GlyphChanged: Max(1,0) gives a wrong result 0, should be 1. > Attached log (both laz and fpc built with -g -gl) > (Had built with fpcup; have deleted all .ppu, .o. .a from both fpc and > laz directories then retried only building fpc, lazarus and bigide, so > no useride) > > Is it me or should something be fixed? > Yes it is you :) No, in fact this is an "impossible" bug. As the error message says, Max function gives a wrong result! See : #22164: Lazarus Startup Error: Invalid floating point operation. http://bugs.freepascal.org/view.php?id=22164 __ My test code looks like this: __ var numg1, numg2: integer; ... numg1:=1; if NumGlyphs > 1 then numg1 := NumGlyphs; numg2:=Max(1, NumGlyphs); if numg1 <> numg2 then raise Exception.CreateFmt('TButtonGlyph.GlyphChanged: Max(1, %d) gives a wrong result %d, should be %d.', [NumGlyphs, numg2, numg1]); NumGlyphs is defined as a range: TNumGlyphs = 1..5; One possible explanation is that the latest compiler has a bug with ranges, maybe calling a wrong overloaded version of Max. Maybe it calls the float version and makes a rounding error (?) Who knows... Anyway Max() really, actually, returns a wrong value, no joking! I cannot reproduce it. I have a 64-bit system and my FPC trunk is few weeks old. I can test with the latest FPC trunk, too. Juha
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
