Bläddra i källkod

* fixed inverted condition in inc/dec range/overflow case that caused
unsigned 32/64 bit values to be always explicitly typecasted to signed
32/64 bit instead of never (mantis #15304)

git-svn-id: trunk@14379 -

Jonas Maebe 15 år sedan
förälder
incheckning
e50c05f44e
3 ändrade filer med 13 tillägg och 2 borttagningar
  1. 1 0
      .gitattributes
  2. 2 2
      compiler/ninl.pas
  3. 10 0
      tests/webtbs/tw15304.pp

+ 1 - 0
.gitattributes

@@ -10111,6 +10111,7 @@ tests/webtbs/tw15088.pp svneol=native#text/plain
 tests/webtbs/tw15169.pp svneol=native#text/plain
 tests/webtbs/tw15207.pp svneol=native#text/plain
 tests/webtbs/tw15274.pp svneol=native#text/plain
+tests/webtbs/tw15304.pp svneol=native#text/plain
 tests/webtbs/tw1532.pp svneol=native#text/plain
 tests/webtbs/tw1539.pp svneol=native#text/plain
 tests/webtbs/tw1567.pp svneol=native#text/plain

+ 2 - 2
compiler/ninl.pas

@@ -2621,9 +2621,9 @@ implementation
 
                    if not((hpp.resultdef.typ=orddef) and
 {$ifndef cpu64bitaddr}
-                          (torddef(hpp.resultdef).ordtype<>u32bit)) then
+                          (torddef(hpp.resultdef).ordtype=u32bit)) then
 {$else not cpu64bitaddr}
-                          (torddef(hpp.resultdef).ordtype<>u64bit)) then
+                          (torddef(hpp.resultdef).ordtype=u64bit)) then
 {$endif not cpu64bitaddr}
                      inserttypeconv_internal(hpp,sinttype);
                    { make sure we don't call functions part of the left node twice (and generally }

+ 10 - 0
tests/webtbs/tw15304.pp

@@ -0,0 +1,10 @@
+{$r+,q+}
+
+var A : LongWord;
+
+begin
+  A := $0FFFFFFF;
+  Inc(A, LongWord($F0000000));
+  // no runtime error if the above line is changed to:
+  // A := A + LongWord($F0000000);
+end.