Firm Bugtracker - libFirm
Viewing Issue Advanced Details
94 lowering minor always 2012-03-14 11:25 2016-01-03 03:28
closed development  
0000094: incorrect lowering for compound returning calls
If the code finds a copyb using the results of the compound retuning function, then it always removes this copyb putting the destination address as hidden parameter to the lowered function. In some situations this is not correct:

* If the destination address is dependent on the call, then you can't use it as function arguments (or you get data-dependency cycles)
* The calls memory input has to be combined with the copyb memory if the copyb is folded in, the copyb memory users have to use the call output. In the general case this requires a sync instruction, but can be optimized in the two common cases of the copyb predecessor being the calls memory output and the calls memory input being nomem.

This bug breaks backends that do something like *(malloc(sizeof(foo)) = func_returning_foo(); where the backend first evaluates func_returning_foo() then the malloc and finally produces the copyb. (cparser is first constructing the left side and is not affected)
Issue History
2012-03-14 11:25 Matze New Issue
2012-09-28 12:56 Matze Status new => confirmed
2013-10-23 13:12 UniQ Note Added: 0000183
2013-10-23 13:12 UniQ Assigned To => Matze
2013-10-23 13:12 UniQ Status confirmed => feedback
2013-10-24 10:17 Matze Note Added: 0000184
2013-10-24 10:17 Matze Assigned To Matze => UniQ
2013-10-24 10:17 Matze Status feedback => resolved
2013-10-24 10:17 Matze Resolution open => fixed
2016-01-03 03:28 Matze Status resolved => closed

2013-10-23 13:12   
Can you check whether the problem still occurs with libfirm bd1b1f0e0f1517ffe997eb103d1b41e4882f3d67 ?
2013-10-24 10:17   
An ad-hoc test shows no problem when I switch cparser constructing the left/side and the testsuite and the patch looks good. So I close this for now.