From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16108 invoked by alias); 10 Apr 2003 14:16:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16088 invoked by uid 71); 10 Apr 2003 14:16:00 -0000 Date: Thu, 10 Apr 2003 14:16:00 -0000 Message-ID: <20030410141600.16087.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Christian Ehrhardt" Subject: Re: middle-end/7018: bitfield of type long long treated as int in shift Reply-To: "Christian Ehrhardt" X-SW-Source: 2003-04/txt/msg00434.txt.bz2 List-Id: The following reply was made to PR middle-end/7018; it has been noted by GNATS. From: "Christian Ehrhardt" To: gcc-gnats@gcc.gnu.org, jbeulich@novell.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Cc: Subject: Re: middle-end/7018: bitfield of type long long treated as int in shift Date: Thu, 10 Apr 2003 16:09:28 +0200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7018 This PR is about this piece of code and it complains that the bitfield is promoted to int instead of unsigned long long in the return statement: struct s { unsigned long long uf:1; }; unsigned long long utest(const struct s*ps) { return ps->uf << 32; } IMHO this is behaviour is correct but the standard is somewhat vague wrt. bit-fields of other types than _Bool, char and int, so I need a language lawyer to make the final decision. The standard does state quite clearly that an unsigned int bitfield with a width less than that of int has to be promoted to int and not to unsigend int, i.e. there is no implicit conversion of the bitfield to its "container type". regards Christian -- THAT'S ALL FOLKS!