public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers
@ 2004-07-22  6:03 segher at kernel dot crashing dot org
  2004-07-22  6:06 ` [Bug c/16667] " segher at kernel dot crashing dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: segher at kernel dot crashing dot org @ 2004-07-22  6:03 UTC (permalink / raw)
  To: gcc-bugs

GCC silently accepts the following invalid code (with -Wall -W, any optimization level,
whether C99 or gnu99 mode is asked for or not):

-- snip --
struct x {
        int a;
        float b;
};

struct x bla = { .a 42 };
-- snip --

(it should be   .a = 42)

-- 
           Summary: GCC allows invalid syntax in C99 designated initializers
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: segher at kernel dot crashing dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/16667] GCC allows invalid syntax in C99 designated initializers
  2004-07-22  6:03 [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers segher at kernel dot crashing dot org
@ 2004-07-22  6:06 ` segher at kernel dot crashing dot org
  2004-07-22  6:27 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: segher at kernel dot crashing dot org @ 2004-07-22  6:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From segher at kernel dot crashing dot org  2004-07-22 06:06 -------
I just discovered that with -pedantic GCC outputs the following warning:

warning: obsolete use of designated initializer without `='

Perhaps this should be unconditional on -pedantic?  Or better yet, upgraded
to an error.

-- 


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


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

* [Bug c/16667] GCC allows invalid syntax in C99 designated initializers
  2004-07-22  6:03 [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers segher at kernel dot crashing dot org
  2004-07-22  6:06 ` [Bug c/16667] " segher at kernel dot crashing dot org
@ 2004-07-22  6:27 ` pinskia at gcc dot gnu dot org
  2004-10-25 22:23 ` cvs-commit at gcc dot gnu dot org
  2004-10-25 22:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22  6:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-22 06:27 -------
Confirmed.
A proposed patch is here: <http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01146.html> but it 
needed some work.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-22 06:27:07
               date|                            |
            Version|unknown                     |3.5.0


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


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

* [Bug c/16667] GCC allows invalid syntax in C99 designated initializers
  2004-07-22  6:03 [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers segher at kernel dot crashing dot org
  2004-07-22  6:06 ` [Bug c/16667] " segher at kernel dot crashing dot org
  2004-07-22  6:27 ` pinskia at gcc dot gnu dot org
@ 2004-10-25 22:23 ` cvs-commit at gcc dot gnu dot org
  2004-10-25 22:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-25 22:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-25 22:23 -------
Subject: Bug 16667

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2004-10-25 22:23:08

Modified files:
	gcc            : ChangeLog c-parse.in 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: init-desig-obs-1.c init-desig-obs-2.c 
	                      init-desig-obs-3.c 

Log message:
	PR c/16667
	* c-parse.in (array_designator): New.
	(designator): Use it.
	(initelt): Only permit array_designator without '=', not ".foo".
	
	testsuite:
	* gcc.dg/init-desig-obs-1.c, gcc.dg/init-desig-obs-2.c,
	gcc.dg/init-desig-obs-3.c: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6014&r2=2.6015
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-parse.in.diff?cvsroot=gcc&r1=1.250&r2=1.251
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4494&r2=1.4495
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-desig-obs-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-desig-obs-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-desig-obs-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c/16667] GCC allows invalid syntax in C99 designated initializers
  2004-07-22  6:03 [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers segher at kernel dot crashing dot org
                   ` (2 preceding siblings ...)
  2004-10-25 22:23 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-25 22:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-25 22:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-25 22:25 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-10-25 22:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22  6:03 [Bug c/16667] New: GCC allows invalid syntax in C99 designated initializers segher at kernel dot crashing dot org
2004-07-22  6:06 ` [Bug c/16667] " segher at kernel dot crashing dot org
2004-07-22  6:27 ` pinskia at gcc dot gnu dot org
2004-10-25 22:23 ` cvs-commit at gcc dot gnu dot org
2004-10-25 22:25 ` 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).