Bug 16918

Summary: When out parameter to inlined functions is used based on the return , the return value is ignored in PPC64 in -O2 and -O3
Product: gcc Reporter: Gopal V <gopalv82>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: minor CC: gcc-bugs, rainer.groesslinger
Priority: P2    
Version: 3.4.0   
Target Milestone: ---   
Host: powerpc-unknown-linux-gnu Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu Known to work:
Known to fail: Last reconfirmed:

Description Gopal V 2004-08-08 13:14:04 UTC
The ILNode_BinaryArith_ILNode_GenValue__() function contains

if(ReduceOperator(info, (ILNode*)node, (ILNode**)&node, commonType))
{
    // recursion
    ILNode_GenValue(node);
}

ReduceOperator returns 1 only if the out parameter was modified - however this
is setting up a recursive loop when compiled with "-O2" , but "-O1" works as
expected. 

When a second variable is used for the outParameter , this is not observed. 

The broken (before/) and workedaround (after/) preprocessed .i file and assembly 
listing are available in
http://demo.dotgnu.org/~t3rmin4t0r/code/ppc64-segfault.tar.gz (159k) .

Test was performed on a DUAL G5 (specs inside the tarball).
Comment 1 Gopal V 2004-08-08 13:22:57 UTC
Lowered priority to minor.
Comment 2 Andrew Pinski 2004-08-08 14:36:57 UTC
You are breaking the C standard aliasing rules:
ILNode*)node, (ILNode**)&node
Comment 3 Andrew Pinski 2005-06-05 08:53:04 UTC
Reopening to ...
Comment 4 Andrew Pinski 2005-06-05 08:53:22 UTC
Mark as a dup of bug 21920

*** This bug has been marked as a duplicate of 21920 ***