Bug 23123 - c++ bit store fails on -O
c++ bit store fails on -O
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
alpha Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  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:
Last Closed: 2001-01-02 09:04:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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 {
    int16_t mFlags;

    FlagTest (void) {
	mFlags = 0;

    void SetFlag (u_int32_t flag, bool value) {
	if (value)
            mFlags |= flag;
            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.