From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18445 invoked by alias); 8 Apr 2006 12:36:23 -0000 Received: (qmail 18395 invoked by uid 48); 8 Apr 2006 12:36:19 -0000 Date: Sat, 08 Apr 2006 12:36:00 -0000 Subject: [Bug c++/27083] New: [4.1,4.2 regression] bit-field value not narrowed X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "falk at debian dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-04/txt/msg00680.txt.bz2 List-Id: 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 -- Summary: [4.1,4.2 regression] bit-field value not narrowed Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: falk at debian dot org GCC build triplet: alphaev68-unknown-linux-gnu GCC host triplet: alphaev68-unknown-linux-gnu GCC target triplet: alphaev68-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27083