Bug 34050 - optimizing bug in GCSE
Summary: optimizing bug in GCSE
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
: 34051 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-30 10:59 UTC by Michael Stefaniuc
Modified: 2007-04-18 16:32 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-03-30 11:16:24 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Michael Stefaniuc 2001-03-30 10:59:38 UTC
gcc produces with -O2 incorrect code, culprit *appears* to be the global
common subexpression elimination. Correct code is produced with -O2
-fno-gcse
Bug is also present in gcc-2.96-80 .

Credits: - Francois Jacques for founding the bug
	 - Ulrich Weigand for the test case


Test case:

void clobber(int *);
void compare(int, int);
void use(int);

int global;

void test(int trigger, int param)
{
    int data = trigger? global : 0;
    int orig_param = param;
    
    clobber(&param);
    compare(orig_param, param);

    use(data);
}

void clobber(int *param)
{
    (*param)++;
}

void compare(int orig_param, int param)
{
    if (orig_param != param)
        printf( "PASS\n" );
    else
        printf( "FAIL\n" );
}

void use(int data)
{
}

int main(void)
{
    test(0, 0);
}

Comment 1 Jakub Jelinek 2001-03-30 11:16:21 UTC
*** Bug 34051 has been marked as a duplicate of this bug. ***

Comment 2 Jakub Jelinek 2001-04-09 11:53:24 UTC
Fixed in gcc-2.96-81.


Note You need to log in before you can comment on or make changes to this bug.