diff --git a/.gitattributes b/.gitattributes index 2886fbcdac..2d44c69796 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8353,6 +8353,7 @@ tests/webtbs/tw9209.pp svneol=native#text/plain tests/webtbs/tw9221.pp svneol=native#text/plain tests/webtbs/tw9261.pp svneol=native#text/x-pascal tests/webtbs/tw9278.pp svneol=native#text/plain +tests/webtbs/tw9299.pp -text tests/webtbs/tw9306a.pp -text tests/webtbs/tw9306b.pp -text tests/webtbs/tw9309.pp -text diff --git a/compiler/nmat.pas b/compiler/nmat.pas index beaabd0c48..33eb453a62 100644 --- a/compiler/nmat.pas +++ b/compiler/nmat.pas @@ -516,7 +516,13 @@ implementation the same as 'shl 1'. It's ugly but compatible with delphi/tp/gcc } if (not is_64bit(left.resultdef)) and (torddef(left.resultdef).ordtype<>u32bit) then - inserttypeconv(left,s32inttype); + begin + { keep singness of orignal type } + if is_signed(left.resultdef) then + inserttypeconv(left,s32inttype) + else + inserttypeconv(left,u32inttype); + end; inserttypeconv(right,sinttype); diff --git a/tests/webtbs/tw9299.pp b/tests/webtbs/tw9299.pp new file mode 100644 index 0000000000..3bb48fa083 --- /dev/null +++ b/tests/webtbs/tw9299.pp @@ -0,0 +1,19 @@ +{$mode objfpc} +{$R+} + +function GetShiftedCard(const c: Cardinal): Cardinal; +begin + Result := c shl 24; +end; + +function GetShiftedByte(const c: Byte): Cardinal; +begin + Result := c shl 24; +end; + +begin + WriteLn(GetShiftedCard(200)); + + WriteLn(GetShiftedByte(200)); + +end.