public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18498] New: gcc allows non-integral bitfield types
@ 2004-11-15 10:08 rwxr-xr-x at gmx dot de
  2004-11-15 13:43 ` [Bug c/18498] " joseph at codesourcery dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2004-11-15 10:08 UTC (permalink / raw)
  To: gcc-bugs

Hello,

$ cat try.c
int main(void) {
	struct X {
        int s[20] : 1;
        int *p : 2;
        int (*f)(float) : 3;
    } x;
    return 0;
}
$ gcc -W -Wall -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -std=c99 -pedantic -O2 try.c
try.c: In function `main':
try.c:6: warning: unused variable `x'
$

I would have expected an error (or at least a warning) for the non-int
bitfields. C99, 6.7.2.1/4 says:

  A bit-field shall have a type that is a qualified or unqualified version of
  _Bool, signed int, unsigned int, or some other implementation-defined type.

int [20], int * and int (*)(float) aren't ints. I couldn't find anything about
bit-field extensions in `info gcc', so it doesn't seem to be
implementation-defined.

Is this a bug in gcc or am I missing something?

Lukas

-- 
           Summary: gcc allows non-integral bitfield types
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rwxr-xr-x at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/18498] gcc allows non-integral bitfield types
  2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
@ 2004-11-15 13:43 ` joseph at codesourcery dot com
  2004-11-15 13:51 ` [Bug c/18498] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2004-11-15 13:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2004-11-15 13:42 -------
Subject: Re:  New: gcc allows non-integral bitfield types

On Mon, 15 Nov 2004, rwxr-xr-x at gmx dot de wrote:

> Is this a bug in gcc or am I missing something?

This is indeed a regression bug in 3.4 and 4.0.  I'm testing a patch.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/18498] [3.4/4.0 Regression] gcc allows non-integral bitfield types
  2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
  2004-11-15 13:43 ` [Bug c/18498] " joseph at codesourcery dot com
@ 2004-11-15 13:51 ` pinskia at gcc dot gnu dot org
  2004-11-15 22:11 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-15 13:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-15 13:51 -------
Confirmed:
: Search converges between 2003-12-16-trunk (#429) and 2003-12-17-trunk (#430).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid, diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-15 13:51:28
               date|                            |
            Summary|gcc allows non-integral     |[3.4/4.0 Regression] gcc
                   |bitfield types              |allows non-integral bitfield
                   |                            |types
   Target Milestone|---                         |3.4.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/18498] [3.4/4.0 Regression] gcc allows non-integral bitfield types
  2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
  2004-11-15 13:43 ` [Bug c/18498] " joseph at codesourcery dot com
  2004-11-15 13:51 ` [Bug c/18498] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-11-15 22:11 ` cvs-commit at gcc dot gnu dot org
  2004-11-16 19:56 ` [Bug c/18498] [3.4 " cvs-commit at gcc dot gnu dot org
  2004-11-16 20:32 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-15 22:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-15 22:10 -------
Subject: Bug 18498

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2004-11-15 22:10:17

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: bitfld-13.c 

Log message:
	PR c/18498
	* c-decl.c (grokdeclarator): Call check_bitfield_type_and_width
	after processing the declarator.
	
	testsuite:
	* gcc.dg/bitfld-13.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6351&r2=2.6352
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.609&r2=1.610
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4611&r2=1.4612
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/bitfld-13.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/18498] [3.4 Regression] gcc allows non-integral bitfield types
  2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
                   ` (2 preceding siblings ...)
  2004-11-15 22:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-16 19:56 ` cvs-commit at gcc dot gnu dot org
  2004-11-16 20:32 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-16 19:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-16 19:56 -------
Subject: Bug 18498

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jsm28@gcc.gnu.org	2004-11-16 19:55:48

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: bitfld-13.c 

Log message:
	PR c/18498
	* c-decl.c (grokdeclarator): Call check_bitfield_type_and_width
	after processing the declarator.
	
	testsuite:
	* gcc.dg/bitfld-13.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.692&r2=2.2326.2.693
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.16&r2=1.470.4.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.309&r2=1.3389.2.310
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/bitfld-13.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/18498] [3.4 Regression] gcc allows non-integral bitfield types
  2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
                   ` (3 preceding siblings ...)
  2004-11-16 19:56 ` [Bug c/18498] [3.4 " cvs-commit at gcc dot gnu dot org
@ 2004-11-16 20:32 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-16 20:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-16 20:32 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18498


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-11-16 20:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-15 10:08 [Bug c/18498] New: gcc allows non-integral bitfield types rwxr-xr-x at gmx dot de
2004-11-15 13:43 ` [Bug c/18498] " joseph at codesourcery dot com
2004-11-15 13:51 ` [Bug c/18498] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-15 22:11 ` cvs-commit at gcc dot gnu dot org
2004-11-16 19:56 ` [Bug c/18498] [3.4 " cvs-commit at gcc dot gnu dot org
2004-11-16 20:32 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).