Why is this error not identified even with Debug mode and Range checks On lazarus / 62-General ---------------------------------------------------------------------- Ten_Mile_Hike · 2025-02-03 22:20 Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Environment[Win 11, Laz 4.0RC2, FPC 3.2.2, {$mode objfpc}, Debug mode]Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 · 2025-02-04 06:03 Yes, strange. It only fails with assignment, though: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // 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 · 2025-02-04 06:17 Reported as #41132 with this simplified full program:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$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.