diff --git a/compiler/ninl.pas b/compiler/ninl.pas index b3aef387d9..955ff345f8 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -63,6 +63,8 @@ interface property parameters : tnode read left write left; function may_have_sideeffect_norecurse: boolean; + + function may_ignore_result:boolean; protected { All the following routines currently call compilerprocs, unless they are @@ -6051,6 +6053,20 @@ implementation end; + function tinlinenode.may_ignore_result:boolean; + begin + case inlinenumber of + in_atomic_inc, + in_atomic_dec, + in_atomic_xchg, + in_atomic_cmp_xchg: + result:=true; + else + result:=is_void(resultdef); + end; + end; + + function tinlinenode.first_fma: tnode; begin CGMessage1(cg_e_function_not_support_by_selected_instruction_set,'FMA'); diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index ec578701a5..5dfabcb0d1 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -50,7 +50,7 @@ implementation paramgr, { pass 1 } pass_1,htypechk, - nutils,ngenutil,nbas,ncal,nmem,nset,ncnv,ncon,nld,nflw, + nutils,ngenutil,nbas,ncal,nmem,nset,ncnv,ncon,nld,nflw,ninl, { parser } scanner, pbase,ptype,pexpr, @@ -1512,7 +1512,7 @@ implementation if not(p.nodetype in [nothingn,errorn,calln,ifn,assignn,breakn,inlinen, continuen,labeln,blockn,exitn,goton]) or ((p.nodetype=inlinen) and - not is_void(p.resultdef)) or + not tinlinenode(p).may_ignore_result) or ((p.nodetype=calln) and (assigned(tcallnode(p).procdefinition)) and (tcallnode(p).procdefinition.proctypeoption=potype_operator)) then