This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 23123 - c++ bit store fails on -O
c++ bit store fails on -O
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
alpha Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-01 23:31 EST by Matt Wilson
Modified: 2007-04-18 12:30 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-02 09:04:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
testcase for bug (525 bytes, text/plain)
2001-01-01 23:33 EST, Matt Wilson
no flags Details

  None (edit)
Description Matt Wilson 2001-01-01 23:31:24 EST
#include <sys/types.h>
#include <stdio.h>

#define FLAG 0x00000200

class FlagTest {
public:
    int16_t mFlags;

    FlagTest (void) {
	mFlags = 0;
    }

    void SetFlag (u_int32_t flag, bool value) {
	if (value)
            mFlags |= flag;
	else
            mFlags &= ~flag;
    }

    bool GetFlag (u_int32_t flag) {
	return (mFlags & flag);
    }
};

int main (void)
{
    FlagTest test;

    printf ("initial state %d\n", test.GetFlag(FLAG));
    test.SetFlag (FLAG, 1);
    printf ("set state %d\n", test.GetFlag(FLAG));
}

[msw@pitr msw]$ gcc -O -o testcase testcase.cpp
You have mail in /home/devel/msw/
[msw@pitr msw]$ ./testcase
initial state 0
set state 0
[msw@pitr msw]$ gcc -o testcase testcase.cpp
[msw@pitr msw]$ ./testcase
initial state 0
set state 1
Comment 1 Matt Wilson 2001-01-01 23:33:02 EST
Created attachment 6943 [details]
testcase for bug
Comment 2 Jakub Jelinek 2001-01-02 09:04:37 EST
Richard fixed this, the patch is in my patchset for 2.96-70.

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