diff --git a/.gitattributes b/.gitattributes index 7a9a975db8..61f8d063f3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7598,6 +7598,7 @@ tests/webtbs/tw0961.pp svneol=native#text/plain tests/webtbs/tw0965.pp svneol=native#text/plain tests/webtbs/tw0966.pp svneol=native#text/plain tests/webtbs/tw0976.pp svneol=native#text/plain +tests/webtbs/tw10009.pp svneol=native#text/plain tests/webtbs/tw10013.pp svneol=native#text/plain tests/webtbs/tw1021.pp svneol=native#text/plain tests/webtbs/tw1023.pp svneol=native#text/plain diff --git a/compiler/arm/narmset.pas b/compiler/arm/narmset.pas index 072daeaab0..8688348e39 100644 --- a/compiler/arm/narmset.pas +++ b/compiler/arm/narmset.pas @@ -153,7 +153,7 @@ implementation if first then begin { have we to ajust the first value ? } - if (t^._low>get_min_value(left.resultdef)) then + if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then begin tcgarm(cg).cgsetflags:=true; cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(int64(t^._low)), hregister); diff --git a/compiler/i386/n386set.pas b/compiler/i386/n386set.pas index a757e40d4d..c148ccf027 100644 --- a/compiler/i386/n386set.pas +++ b/compiler/i386/n386set.pas @@ -174,7 +174,7 @@ implementation if first then begin { have we to ajust the first value ? } - if (t^._low>get_min_value(left.resultdef)) then + if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low.svalue), hregister); end else diff --git a/compiler/ncgset.pas b/compiler/ncgset.pas index 77c2fa3bee..14f21503cd 100644 --- a/compiler/ncgset.pas +++ b/compiler/ncgset.pas @@ -532,7 +532,7 @@ implementation if first then begin { have we to ajust the first value ? } - if (t^._low>get_min_value(left.resultdef)) then + if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then gensub(aint(t^._low.svalue)); end else diff --git a/compiler/ppcgen/ngppcset.pas b/compiler/ppcgen/ngppcset.pas index a3e27f7c17..b6e92053a0 100644 --- a/compiler/ppcgen/ngppcset.pas +++ b/compiler/ppcgen/ngppcset.pas @@ -199,7 +199,7 @@ implementation if first then begin { have we to ajust the first value ? } - if (t^._low>get_min_value(left.resultdef)) then + if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then gensub(longint(int64(t^._low))); end else diff --git a/tests/webtbs/tw10009.pp b/tests/webtbs/tw10009.pp new file mode 100644 index 0000000000..53a738ffea --- /dev/null +++ b/tests/webtbs/tw10009.pp @@ -0,0 +1,13 @@ +var + test : 2..14; + +begin + test:=14; + case test of + 2..9: halt(1); + 14: ; + else + halt(1); + end; + writeln('ok'); +end.