Forum > General
Why is this error not identified even with Debug mode and Range checks On
(1/1)
Ten_Mile_Hike:
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Environment[Win 11, Laz 4.0RC2, FPC 3.2.2, {$mode objfpc}, Debug mode]
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);type q = 1..10;var x: integer; Mark: set of q;begin Mark := [5, 11];{<-Why doesn't 11 cause a range check error?} for x in Mark do Memo1.Lines.add(IntToStr(x) + ' IN Mark');end;
Thaddy:
Yes, strange. It only fails with assignment, though:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---// mark := [5,11] // should fail, but does not. mark :=[] include(mark,5);// OK include(mark,11)// fails, rangecheck errorOTOH the for in do doesn't see the 11 as part of the set so that behaves correct.
I also tested making the set a type too, but the same behavior: it does not range check the inititial set assignment.
This is a bug indeed, also in 3.3.1.
I will report it with a simplified example.
Thaddy:
Reported as #41132 with this simplified full program:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$mode objfpc}{$H+}{$R+}type TmyRange = 1..10;var x: integer; Mark: set of TmyRange;begin Mark := [5,11];{<-Why doesn't 11 cause a range check error?} for x in Mark do write(x,' IN Mark');end.
Navigation
[0] Message Index