Bug 16918 - When out parameter to inlined functions is used based on the return , the return value is ignored in PPC64 in -O2 and -O3
Summary: When out parameter to inlined functions is used based on the return , the ret...
Status: RESOLVED DUPLICATE of bug 21920
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.0
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-08-08 13:14 UTC by Gopal V
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host: powerpc-unknown-linux-gnu
Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
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

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

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 ***