* never keep a value in a register for llvm if it's typecasted on the

left-hand side of an assignment (you can't typecast lvalues in llvm)

git-svn-id: trunk@30708 -
This commit is contained in:
Jonas Maebe 2015-04-25 15:50:55 +00:00
parent d16da8a32b
commit 61ddaab091

View File

@ -1500,17 +1500,25 @@ implementation
is_open_array(fromdef) or
is_open_array(todef) or
((fromdef.typ=pointerdef) and (todef.typ=arraydef)) or
(def_is_related(fromdef,todef))) and
(fromdef.size<>todef.size) then
(def_is_related(fromdef,todef))) then
begin
{ in TP it is allowed to typecast to smaller types. But the variable can't
be in a register }
if (m_tp7 in current_settings.modeswitches) or
(todef.size<fromdef.size) then
make_not_regable(hp,[ra_addr_regable])
if (fromdef.size<>todef.size) then
begin
{ in TP it is allowed to typecast to smaller types. But the variable can't
be in a register }
if (m_tp7 in current_settings.modeswitches) or
(todef.size<fromdef.size) then
make_not_regable(hp,[ra_addr_regable])
else
if report_errors then
CGMessagePos2(hp.fileinfo,type_e_typecast_wrong_size_for_assignment,tostr(fromdef.size),tostr(todef.size));
end
{$ifdef llvm}
{ we can never typecast a non-memory value on the assignment
side in llvm }
else
if report_errors then
CGMessagePos2(hp.fileinfo,type_e_typecast_wrong_size_for_assignment,tostr(fromdef.size),tostr(todef.size));
make_not_regable(hp,[ra_addr_regable])
{$endif llvm}
end;
{ don't allow assignments to typeconvs that need special code }