Bug 34050 - optimizing bug in GCSE
optimizing bug in GCSE
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
: 34051 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-30 05:59 EST by Michael Stefaniuc
Modified: 2007-04-18 12:32 EDT (History)
1 user (show)

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


Attachments (Terms of Use)

  None (edit)
Description Michael Stefaniuc 2001-03-30 05:59:38 EST
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 06:16:21 EST
*** Bug 34051 has been marked as a duplicate of this bug. ***
Comment 2 Jakub Jelinek 2001-04-09 07:53:24 EDT
Fixed in gcc-2.96-81.

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