* return OS_NO from int_cgsize() for sizes which are not a power of 2

(fixes crash in tests/test/cg/tpara2.pp for ppc, does not break i386)

git-svn-id: trunk@3159 -
This commit is contained in:
Jonas Maebe 2006-04-06 22:09:25 +00:00
parent 4fd88e366c
commit eb9f00193b
3 changed files with 51 additions and 1 deletions

1
.gitattributes vendored
View File

@ -5559,6 +5559,7 @@ tests/test/cg/tnot.pp svneol=native#text/plain
tests/test/cg/tobjsiz2.pp svneol=native#text/plain
tests/test/cg/tobjsize.pp svneol=native#text/plain
tests/test/cg/tpara1.pp svneol=native#text/plain
tests/test/cg/tpara2.pp svneol=native#text/plain
tests/test/cg/tprintf.pp svneol=native#text/plain
tests/test/cg/traise1.pp svneol=native#text/plain
tests/test/cg/traise2.pp svneol=native#text/plain

View File

@ -562,7 +562,7 @@ implementation
function int_cgsize(const a: aint): tcgsize;{$ifdef USEINLINE}inline;{$endif}
const
size2cgsize : array[0..8] of tcgsize = (
OS_NO,OS_8,OS_16,OS_32,OS_32,OS_64,OS_64,OS_64,OS_64
OS_NO,OS_8,OS_16,OS_NO,OS_32,OS_NO,OS_NO,OS_NO,OS_64
);
begin
if a>8 then

49
tests/test/cg/tpara2.pp Normal file
View File

@ -0,0 +1,49 @@
type
sint16 = smallint;
uint16 = word;
Point = record
case SInt16 of
0: (
v: SInt16;
h: SInt16;
);
1: (
vh: array [0..1] of SInt16;
);
end;
Rect = record
case SInt16 of
0: (
top: SInt16;
left: SInt16;
bottom: SInt16;
right: SInt16;
);
1: (
topLeft: Point;
botRight: Point;
);
end;
RGBColor = record
red: UInt16;
{ magnitude of red component }
green: UInt16;
{ magnitude of green component }
blue: UInt16;
{ magnitude of blue component }
end;
function test(r: Rect; c1, c2: RGBColor): Rect;
begin
test:= r;
end;
var
r: rect;
c1,c2: rgbcolor;
begin
test(r,c1,c2);
end.