mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 15:59:28 +01:00 
			
		
		
		
	* fixed type conversions from dynamic arrays to open arrays
This commit is contained in:
		
							parent
							
								
									8ddb738e07
								
							
						
					
					
						commit
						cd378a2881
					
				@ -455,11 +455,6 @@ implementation
 | 
				
			|||||||
                   end;
 | 
					                   end;
 | 
				
			||||||
                 location.resflags:=F_NE;
 | 
					                 location.resflags:=F_NE;
 | 
				
			||||||
              end;
 | 
					              end;
 | 
				
			||||||
             in_reset_typedfile,in_rewrite_typedfile :
 | 
					 | 
				
			||||||
               begin
 | 
					 | 
				
			||||||
                  { should be removed in pass_1 (JM) }
 | 
					 | 
				
			||||||
                  internalerror(200108132);
 | 
					 | 
				
			||||||
               end;
 | 
					 | 
				
			||||||
            in_setlength_x:
 | 
					            in_setlength_x:
 | 
				
			||||||
               begin
 | 
					               begin
 | 
				
			||||||
                  pushusedregisters(pushed,$ff);
 | 
					                  pushusedregisters(pushed,$ff);
 | 
				
			||||||
@ -548,22 +543,6 @@ implementation
 | 
				
			|||||||
                  popusedregisters(pushed);
 | 
					                  popusedregisters(pushed);
 | 
				
			||||||
                  maybe_loadself;
 | 
					                  maybe_loadself;
 | 
				
			||||||
               end;
 | 
					               end;
 | 
				
			||||||
              in_read_x,
 | 
					 | 
				
			||||||
              in_readln_x,
 | 
					 | 
				
			||||||
              in_write_x,
 | 
					 | 
				
			||||||
              in_writeln_x :
 | 
					 | 
				
			||||||
                { should be removed in the resulttype pass already (JM) }
 | 
					 | 
				
			||||||
                internalerror(200108162);
 | 
					 | 
				
			||||||
            in_str_x_string :
 | 
					 | 
				
			||||||
              begin
 | 
					 | 
				
			||||||
                 { should be removed in det_resulttype (JM) }
 | 
					 | 
				
			||||||
                 internalerror(200108131);
 | 
					 | 
				
			||||||
              end;
 | 
					 | 
				
			||||||
            in_val_x :
 | 
					 | 
				
			||||||
              Begin
 | 
					 | 
				
			||||||
                 { should be removed in det_resulttype (JM) }
 | 
					 | 
				
			||||||
                 internalerror(200108241);
 | 
					 | 
				
			||||||
              End;
 | 
					 | 
				
			||||||
            in_include_x_y,
 | 
					            in_include_x_y,
 | 
				
			||||||
            in_exclude_x_y:
 | 
					            in_exclude_x_y:
 | 
				
			||||||
              begin
 | 
					              begin
 | 
				
			||||||
@ -750,7 +729,10 @@ begin
 | 
				
			|||||||
end.
 | 
					end.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  $Log$
 | 
					  $Log$
 | 
				
			||||||
  Revision 1.29  2001-12-04 15:59:03  jonas
 | 
					  Revision 1.30  2001-12-10 14:34:04  jonas
 | 
				
			||||||
 | 
					    * fixed type conversions from dynamic arrays to open arrays
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Revision 1.29  2001/12/04 15:59:03  jonas
 | 
				
			||||||
    * converted lo/hi to processor independent code, generated code is the
 | 
					    * converted lo/hi to processor independent code, generated code is the
 | 
				
			||||||
      same as before (when turning on the optimizer)
 | 
					      same as before (when turning on the optimizer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -55,6 +55,7 @@ interface
 | 
				
			|||||||
          function resulttype_arrayconstructor_to_set : tnode;
 | 
					          function resulttype_arrayconstructor_to_set : tnode;
 | 
				
			||||||
          function resulttype_pchar_to_string : tnode;
 | 
					          function resulttype_pchar_to_string : tnode;
 | 
				
			||||||
          function resulttype_interface_to_guid : tnode;
 | 
					          function resulttype_interface_to_guid : tnode;
 | 
				
			||||||
 | 
					          function resulttype_dynarray_to_openarray : tnode;
 | 
				
			||||||
          function resulttype_call_helper(c : tconverttype) : tnode;
 | 
					          function resulttype_call_helper(c : tconverttype) : tnode;
 | 
				
			||||||
       protected
 | 
					       protected
 | 
				
			||||||
          function first_int_to_int : tnode;virtual;
 | 
					          function first_int_to_int : tnode;virtual;
 | 
				
			||||||
@ -133,7 +134,7 @@ implementation
 | 
				
			|||||||
      globtype,systems,tokens,
 | 
					      globtype,systems,tokens,
 | 
				
			||||||
      cutils,verbose,globals,widestr,
 | 
					      cutils,verbose,globals,widestr,
 | 
				
			||||||
      symconst,symdef,symsym,symtable,
 | 
					      symconst,symdef,symsym,symtable,
 | 
				
			||||||
      ncon,ncal,nset,nadd,ninl,
 | 
					      ncon,ncal,nset,nadd,ninl,nmem,
 | 
				
			||||||
      cgbase,
 | 
					      cgbase,
 | 
				
			||||||
      htypechk,pass_1,cpubase,cpuinfo;
 | 
					      htypechk,pass_1,cpubase,cpuinfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -731,6 +732,20 @@ implementation
 | 
				
			|||||||
      end;
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function ttypeconvnode.resulttype_dynarray_to_openarray : tnode;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        { a dynamic array is a pointer to an array, so to convert it to }
 | 
				
			||||||
 | 
					        { an open array, we have to dereference it (JM)                 }
 | 
				
			||||||
 | 
					        result := ctypeconvnode.create(left,voidpointertype);
 | 
				
			||||||
 | 
					        { left is reused }
 | 
				
			||||||
 | 
					        left := nil;
 | 
				
			||||||
 | 
					        result.toggleflag(nf_explizit);
 | 
				
			||||||
 | 
					        result := cderefnode.create(result);
 | 
				
			||||||
 | 
					        result.resulttype := resulttype;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function ttypeconvnode.resulttype_call_helper(c : tconverttype) : tnode;
 | 
					    function ttypeconvnode.resulttype_call_helper(c : tconverttype) : tnode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const
 | 
					      const
 | 
				
			||||||
@ -762,7 +777,8 @@ implementation
 | 
				
			|||||||
          { intf_2_guid } @ttypeconvnode.resulttype_interface_to_guid,
 | 
					          { intf_2_guid } @ttypeconvnode.resulttype_interface_to_guid,
 | 
				
			||||||
          { class_2_intf } nil,
 | 
					          { class_2_intf } nil,
 | 
				
			||||||
          { char_2_char } @ttypeconvnode.resulttype_char_to_char,
 | 
					          { char_2_char } @ttypeconvnode.resulttype_char_to_char,
 | 
				
			||||||
          { nomal_2_smallset} nil
 | 
					          { normal_2_smallset} nil,
 | 
				
			||||||
 | 
					          { dynarray_2_openarray} @resulttype_dynarray_to_openarray
 | 
				
			||||||
         );
 | 
					         );
 | 
				
			||||||
      type
 | 
					      type
 | 
				
			||||||
         tprocedureofobject = function : tnode of object;
 | 
					         tprocedureofobject = function : tnode of object;
 | 
				
			||||||
@ -1404,6 +1420,7 @@ implementation
 | 
				
			|||||||
           @ttypeconvnode.first_nothing,
 | 
					           @ttypeconvnode.first_nothing,
 | 
				
			||||||
           @ttypeconvnode.first_class_to_intf,
 | 
					           @ttypeconvnode.first_class_to_intf,
 | 
				
			||||||
           @ttypeconvnode.first_char_to_char,
 | 
					           @ttypeconvnode.first_char_to_char,
 | 
				
			||||||
 | 
					           @ttypeconvnode.first_nothing,
 | 
				
			||||||
           @ttypeconvnode.first_nothing
 | 
					           @ttypeconvnode.first_nothing
 | 
				
			||||||
         );
 | 
					         );
 | 
				
			||||||
      type
 | 
					      type
 | 
				
			||||||
@ -1618,7 +1635,10 @@ begin
 | 
				
			|||||||
end.
 | 
					end.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  $Log$
 | 
					  $Log$
 | 
				
			||||||
  Revision 1.46  2001-12-06 17:57:34  florian
 | 
					  Revision 1.47  2001-12-10 14:34:04  jonas
 | 
				
			||||||
 | 
					    * fixed type conversions from dynamic arrays to open arrays
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Revision 1.46  2001/12/06 17:57:34  florian
 | 
				
			||||||
    + parasym to tparaitem added
 | 
					    + parasym to tparaitem added
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Revision 1.45  2001/12/03 21:48:41  peter
 | 
					  Revision 1.45  2001/12/03 21:48:41  peter
 | 
				
			||||||
 | 
				
			|||||||
@ -186,7 +186,8 @@ interface
 | 
				
			|||||||
          tc_intf_2_guid,
 | 
					          tc_intf_2_guid,
 | 
				
			||||||
          tc_class_2_intf,
 | 
					          tc_class_2_intf,
 | 
				
			||||||
          tc_char_2_char,
 | 
					          tc_char_2_char,
 | 
				
			||||||
          tc_normal_2_smallset
 | 
					          tc_normal_2_smallset,
 | 
				
			||||||
 | 
					          tc_dynarray_2_openarray
 | 
				
			||||||
       );
 | 
					       );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
 | 
					    function assignment_overloaded(from_def,to_def : tdef) : tprocdef;
 | 
				
			||||||
@ -1174,6 +1175,12 @@ implementation
 | 
				
			|||||||
                     (is_array_of_const(def2) and is_array_constructor(def1));
 | 
					                     (is_array_of_const(def2) and is_array_constructor(def1));
 | 
				
			||||||
                 end
 | 
					                 end
 | 
				
			||||||
               else
 | 
					               else
 | 
				
			||||||
 | 
					                if (is_dynamic_array(def1) or is_dynamic_array(def2)) then
 | 
				
			||||||
 | 
					                  begin
 | 
				
			||||||
 | 
					                    b := is_dynamic_array(def1) and is_dynamic_array(def2) and
 | 
				
			||||||
 | 
					                         is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
 | 
				
			||||||
 | 
					                  end
 | 
				
			||||||
 | 
					               else   
 | 
				
			||||||
                if is_open_array(def1) or is_open_array(def2) then
 | 
					                if is_open_array(def1) or is_open_array(def2) then
 | 
				
			||||||
                 begin
 | 
					                 begin
 | 
				
			||||||
                   b:=is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
 | 
					                   b:=is_equal(tarraydef(def1).elementtype.def,tarraydef(def2).elementtype.def);
 | 
				
			||||||
@ -1522,6 +1529,15 @@ implementation
 | 
				
			|||||||
                               b:=2;
 | 
					                               b:=2;
 | 
				
			||||||
                             end;
 | 
					                             end;
 | 
				
			||||||
                         end
 | 
					                         end
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                         { dynamic array -> open array }
 | 
				
			||||||
 | 
					                         if is_dynamic_array(def_from) and
 | 
				
			||||||
 | 
					                            is_open_array(def_to) and
 | 
				
			||||||
 | 
					                            is_equal(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
 | 
				
			||||||
 | 
					                           begin
 | 
				
			||||||
 | 
					                             doconv := tc_dynarray_2_openarray;
 | 
				
			||||||
 | 
					                             b := 2;
 | 
				
			||||||
 | 
					                           end
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                        { array of tvarrec -> array of const }
 | 
					                        { array of tvarrec -> array of const }
 | 
				
			||||||
                         if is_array_of_const(def_to) and
 | 
					                         if is_array_of_const(def_to) and
 | 
				
			||||||
@ -1869,7 +1885,10 @@ implementation
 | 
				
			|||||||
end.
 | 
					end.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  $Log$
 | 
					  $Log$
 | 
				
			||||||
  Revision 1.58  2001-12-03 21:48:43  peter
 | 
					  Revision 1.59  2001-12-10 14:34:04  jonas
 | 
				
			||||||
 | 
					    * fixed type conversions from dynamic arrays to open arrays
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Revision 1.58  2001/12/03 21:48:43  peter
 | 
				
			||||||
    * freemem change to value parameter
 | 
					    * freemem change to value parameter
 | 
				
			||||||
    * torddef low/high range changed to int64
 | 
					    * torddef low/high range changed to int64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user