mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 17:49:27 +02:00
* fixed web bug #1396: tpointerord is now a cardinal instead of a longint,
but added a hack in ncnv so that pointer(-1) still works
This commit is contained in:
parent
40104b2a7a
commit
74c1d32ce9
@ -37,7 +37,11 @@ Type
|
|||||||
{ this must be an ordinal type with the same size as a pointer }
|
{ this must be an ordinal type with the same size as a pointer }
|
||||||
{ to allow some dirty type casts for example when using }
|
{ to allow some dirty type casts for example when using }
|
||||||
{ tconstsym.value }
|
{ tconstsym.value }
|
||||||
TPointerOrd = longint;
|
{ Note: must be unsigned!! Otherwise, ugly code like }
|
||||||
|
{ pointer(-1) will result in a pointer with the value }
|
||||||
|
{ $fffffffffffffff on a 32bit machine if the compiler uses }
|
||||||
|
{ int64 constants internally (JM) }
|
||||||
|
TPointerOrd = cardinal;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
{ Size of native extended type }
|
{ Size of native extended type }
|
||||||
@ -48,7 +52,11 @@ Implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 2000-10-15 09:39:37 peter
|
Revision 1.2 2001-02-08 13:09:03 jonas
|
||||||
|
* fixed web bug 1396: tpointerord is now a cardinal instead of a longint,
|
||||||
|
but added a hack in ncnv so that pointer(-1) still works
|
||||||
|
|
||||||
|
Revision 1.1 2000/10/15 09:39:37 peter
|
||||||
* moved cpu*.pas to i386/
|
* moved cpu*.pas to i386/
|
||||||
* renamed n386 to common cpunode
|
* renamed n386 to common cpunode
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ implementation
|
|||||||
{$else newcg}
|
{$else newcg}
|
||||||
hcodegen,
|
hcodegen,
|
||||||
{$endif newcg}
|
{$endif newcg}
|
||||||
htypechk,pass_1,cpubase;
|
htypechk,pass_1,cpubase,cpuinfo;
|
||||||
|
|
||||||
|
|
||||||
function gentypeconvnode(node : tnode;t : pdef) : ttypeconvnode;
|
function gentypeconvnode(node : tnode;t : pdef) : ttypeconvnode;
|
||||||
@ -657,7 +657,23 @@ implementation
|
|||||||
first_cord_to_pointer:=nil;
|
first_cord_to_pointer:=nil;
|
||||||
if left.nodetype=ordconstn then
|
if left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
t:=genpointerconstnode(tordconstnode(left).value,resulttype);
|
{ check if we have a valid pointer constant (JM) }
|
||||||
|
if (sizeof(tordconstnode) > sizeof(tpointerord)) then
|
||||||
|
if (sizeof(tpointerord) = 4) then
|
||||||
|
begin
|
||||||
|
if (tordconstnode(left).value < low(longint)) or
|
||||||
|
(tordconstnode(left).value > high(cardinal)) then
|
||||||
|
CGMessage(parser_e_range_check_error);
|
||||||
|
end
|
||||||
|
else if (sizeof(tpointerord) = 8) then
|
||||||
|
begin
|
||||||
|
if (tordconstnode(left).value < low(int64)) or
|
||||||
|
(tordconstnode(left).value > high(qword)) then
|
||||||
|
CGMessage(parser_e_range_check_error);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
internalerror(2001020801);
|
||||||
|
t:=genpointerconstnode(tpointerord(tordconstnode(left).value),resulttype);
|
||||||
firstpass(t);
|
firstpass(t);
|
||||||
first_cord_to_pointer:=t;
|
first_cord_to_pointer:=t;
|
||||||
exit;
|
exit;
|
||||||
@ -1203,7 +1219,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 2000-12-31 11:14:10 jonas
|
Revision 1.17 2001-02-08 13:09:03 jonas
|
||||||
|
* fixed web bug 1396: tpointerord is now a cardinal instead of a longint,
|
||||||
|
but added a hack in ncnv so that pointer(-1) still works
|
||||||
|
|
||||||
|
Revision 1.16 2000/12/31 11:14:10 jonas
|
||||||
+ implemented/fixed docompare() mathods for all nodes (not tested)
|
+ implemented/fixed docompare() mathods for all nodes (not tested)
|
||||||
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
|
+ nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
|
||||||
and constant strings/chars together
|
and constant strings/chars together
|
||||||
|
Loading…
Reference in New Issue
Block a user