Bug 27083 - [4.1,4.2 regression] bit-field value not narrowed
Summary: [4.1,4.2 regression] bit-field value not narrowed
Status: RESOLVED DUPLICATE of bug 26534
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2006-04-08 12:36 UTC by Falk Hueffner
Modified: 2006-04-08 18:56 UTC (History)
5 users (show)

See Also:
Host: alphaev68-unknown-linux-gnu
Target: alphaev68-unknown-linux-gnu
Build: alphaev68-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Falk Hueffner 2006-04-08 12:36:19 UTC
falk@juist:/tmp% cat test.c
#ifdef __cplusplus
extern "C"
#endif
void abort(void);

__attribute__((noinline))
unsigned long f(const unsigned long x) {
    struct { unsigned long x : 1; } s;
    s.x = x;
    return s.x;
}

int main() {
    if (f(3) != 1)
        abort();
}
falk@juist:/tmp% gcc test.c && ./a.out   
falk@juist:/tmp% g++ test.c && ./a.out  
falk@juist:/tmp% g++ -O test.c && ./a.out 
zsh: abort (core dumped)  ./a.out

not a problem with 4.0 or earlier
Comment 1 Andrew Pinski 2006-04-08 18:56:49 UTC
This is a dup of bug 26534.

*** This bug has been marked as a duplicate of 26534 ***