public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode
@ 2003-08-16  8:25 falk at debian dot org
  2003-08-16  9:04 ` [Bug c/11943] " debian-gcc at lists dot debian dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-08-16  8:25 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Accepts invalid declaration "int x[2, 3];" in C99 mode
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org

In C99, the brackets must contain an assignment-expression, however, "2, 3" is
not an assignment-expression. I don't have the C89 standard, but I guess it's
similar.

It would be nice to reject this code, because it's a totally useless language
extension, and it might confuse newbies trying to declare two-dimensional arrays.


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

* [Bug c/11943] Accepts invalid declaration "int x[2, 3];" in C99 mode
  2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
@ 2003-08-16  9:04 ` debian-gcc at lists dot debian dot org
  2003-08-16 13:19 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2003-08-16  9:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


debian-gcc at lists dot debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |debian-gcc at lists dot
                   |                            |debian dot org


------- Additional Comments From debian-gcc at lists dot debian dot org  2003-08-16 09:04 -------
[forwarded from http://bugs.debian.org/177303]


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

* [Bug c/11943] Accepts invalid declaration "int x[2, 3];" in C99 mode
  2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
  2003-08-16  9:04 ` [Bug c/11943] " debian-gcc at lists dot debian dot org
@ 2003-08-16 13:19 ` pinskia at gcc dot gnu dot org
  2003-08-23  1:19 ` dhazeghi at yahoo dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-16 13:19 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-16 13:19:31
               date|                            |


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-16 13:19 -------
I can confirm this on the mainline (20030815).
The problem is that in the c-parse.y (really c-parse.in)
The array_declarator is defined as follows:
array_declarator:
        '[' maybe_type_quals_attrs expr ']'
                { $$ = build_array_declarator ($3, $2, 0, 0); }
        | '[' maybe_type_quals_attrs ']'
                { $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
        | '[' maybe_type_quals_attrs '*' ']'
                { $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
        | '[' STATIC maybe_type_quals_attrs expr ']'
                { $$ = build_array_declarator ($4, $3, 1, 0); }
        /* declspecs_nosc_nots is a synonym for type_quals_attrs.  */
        | '[' declspecs_nosc_nots STATIC expr ']'
                { $$ = build_array_declarator ($4, $2, 1, 0); }
        ;
which is different from what C99 says.


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

* [Bug c/11943] Accepts invalid declaration "int x[2, 3];" in C99 mode
  2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
  2003-08-16  9:04 ` [Bug c/11943] " debian-gcc at lists dot debian dot org
  2003-08-16 13:19 ` pinskia at gcc dot gnu dot org
@ 2003-08-23  1:19 ` dhazeghi at yahoo dot com
  2003-10-24 15:39 ` cvs-commit at gcc dot gnu dot org
  2003-10-24 16:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:19 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c/11943] Accepts invalid declaration "int x[2, 3];" in C99 mode
  2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
                   ` (2 preceding siblings ...)
  2003-08-23  1:19 ` dhazeghi at yahoo dot com
@ 2003-10-24 15:39 ` cvs-commit at gcc dot gnu dot org
  2003-10-24 16:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-10-24 15:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-10-24 15:30 -------
Subject: Bug 11943

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2003-10-24 15:30:37

Modified files:
	gcc            : ChangeLog c-parse.in 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: c99-arraydecl-2.c 

Log message:
	* c-parse.in (array_declarator): Use expr_no_commas.
	Fixes PR c/11943.
	
	testsuite:
	* gcc.dg/c99-arraydecl-2.c: New test.  PR c/11943.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1542&r2=2.1543
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-parse.in.diff?cvsroot=gcc&r1=1.187&r2=1.188
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3143&r2=1.3144
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-arraydecl-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug c/11943] Accepts invalid declaration "int x[2, 3];" in C99 mode
  2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
                   ` (3 preceding siblings ...)
  2003-10-24 15:39 ` cvs-commit at gcc dot gnu dot org
@ 2003-10-24 16:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-24 16:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-24 16:11 -------
Fixed for 3.4.


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

end of thread, other threads:[~2003-10-24 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-16  8:25 [Bug c/11943] New: Accepts invalid declaration "int x[2, 3];" in C99 mode falk at debian dot org
2003-08-16  9:04 ` [Bug c/11943] " debian-gcc at lists dot debian dot org
2003-08-16 13:19 ` pinskia at gcc dot gnu dot org
2003-08-23  1:19 ` dhazeghi at yahoo dot com
2003-10-24 15:39 ` cvs-commit at gcc dot gnu dot org
2003-10-24 16:12 ` 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).