Bug 23123

Summary: c++ bit store fails on -O
Product: [Retired] Red Hat Linux Reporter: Matt Wilson <msw>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: blizzard
Target Milestone: ---   
Target Release: ---   
Hardware: alpha   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-01-02 14:04:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
testcase for bug none

Description Matt Wilson 2001-01-02 04:31:24 UTC
#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-02 04:33:02 UTC
Created attachment 6943 [details]
testcase for bug

Comment 2 Jakub Jelinek 2001-01-02 14:04:37 UTC
Richard fixed this, the patch is in my patchset for 2.96-70.