Bug 23123 - c++ bit store fails on -O
Summary: c++ bit store fails on -O
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.0
Hardware: alpha Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-01-02 04:31 UTC by Matt Wilson
Modified: 2007-04-18 16:30 UTC (History)
1 user (show)

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: ---


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

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.


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