public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8420: volatile after the type specifier for an unnamed structure is rejected
@ 2002-12-11 15:46 Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2002-12-11 15:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/8420; it has been noted by GNATS.

From: Richard Henderson <rth@redhat.com>
To: ehrhardt@mathematik.uni-ulm.de
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/8420: volatile after the type specifier for an unnamed structure is rejected
Date: Wed, 11 Dec 2002 15:40:19 -0800

 On Fri, Nov 01, 2002 at 10:14:09AM -0000, ehrhardt@mathematik.uni-ulm.de wrote:
 > struct c {
 > 	struct  { int x; } volatile;
 > };  /* ERROR */
 > 
 > theseus$ gcc -Wall -c t.c
 > t.c:10: unnamed fields of type other than struct or union are not allowed
 [...]
 > Given the other two examples (struct a and struct b) which are accepted
 > this code should probably be legal.
 
 I don't agree.  I think this is very confusing syntax.
 
 > Even if it is illegal the error message is wrong.
 
 Granted.
 
 
 r~


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

* Re: c/8420: volatile after the type specifier for an unnamed structure is rejected
@ 2002-12-11 16:36 Christian Ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2002-12-11 16:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/8420; it has been noted by GNATS.

From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/8420: volatile after the type specifier for an unnamed structure is rejected
Date: Thu, 12 Dec 2002 01:34:25 +0100

 On Wed, Dec 11, 2002 at 03:40:19PM -0800, Richard Henderson wrote:
 > On Fri, Nov 01, 2002 at 10:14:09AM -0000, ehrhardt@mathematik.uni-ulm.de wrote:
 > > struct c {
 > > 	struct  { int x; } volatile;
 > > };  /* ERROR */
 > > 
 > > theseus$ gcc -Wall -c t.c
 > > t.c:10: unnamed fields of type other than struct or union are not allowed
 > [...]
 > > Given the other two examples (struct a and struct b) which are accepted
 > > this code should probably be legal.
 > 
 > I don't agree.  I think this is very confusing syntax.
 
 I agree that it is confusing, but normally the order in which type
 specifiers and type qualifiers appear is irrelevant. This is shown
 by the fact that
 struct {
 	struct { int a; } volatile name;
 } X;
 is accepted and legal. If we continue to allow this we should also
 allow it for anon structs. Having said that I don't particularly care
 about this, as already said in the orignal report this is to point out
 what looks like an oversight in c-decl.c: The declspecs passed to 
 grokfield may contain qualifiers and it is not safe to assume that
 the type specifier is the last thing in a declspec and hence the first
 thing in the declspec list as returned from the parser.
 
 > > Even if it is illegal the error message is wrong.
 > 
 > Granted.
 
 3.3. meanwhile gives a somewhat better message. The proper solution
 is IMHO to move the whole check for unnamed types from grokfield to
 grokdeclarator and do the check when we know which element on the
 declspec list is the type specifier.
 
     regards  Christian
 
 -- 
 THAT'S ALL FOLKS!


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

* Re: c/8420: volatile after the type specifier for an unnamed structure is rejected
@ 2002-12-02 13:09 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2002-12-02 13:09 UTC (permalink / raw)
  To: ehrhardt, gcc-bugs, gcc-prs, nobody

Synopsis: volatile after the type specifier for an unnamed structure is rejected

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Dec  2 13:09:35 2002
State-Changed-Why:
    Confirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8420


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

* c/8420: volatile after the type specifier for an unnamed structure is rejected
@ 2002-11-01  2:16 ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: ehrhardt @ 2002-11-01  2:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8420
>Category:       c
>Synopsis:       volatile after the type specifier for an unnamed structure is rejected
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 01 02:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Ehrhardt
>Release:        gcc-3.2
>Organization:
>Environment:
theseus$ uname -a
SunOS theseus 5.9 Generic_112233-02 sun4u sparc SUNW,Ultra-4
theseus$ gcc -v
Reading specs from /usr/local/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.2/specs
Configured with: /export/local/manager/playground/ULMgcc32/src/gcc-3.2/configure --with-ld=/usr/local/bin/ld --with-gnu-ld --with-as=/usr/local/bin/as --with-gnu-as --prefix=/usr/local/
Thread model: posix
gcc version 3.2
>Description:
This source file is rejected:

struct a {
	struct  { int x; } volatile a;
};  /* OK */

struct b {
	volatile struct  { int x; } ;
};  /* OK */

struct c {
	struct  { int x; } volatile;
};  /* ERROR */

theseus$ gcc -Wall -c t.c
t.c:10: unnamed fields of type other than struct or union are not allowed

This code is made up to demonstrate a problem found while reading the
source: grokfield is called for a field declaration without an identifier
and tries to check that the field type is a structure or union.
However, grokfield assumes that the type specifier is the first element
in the list passed as declspecs which is not necessarily true.

Given the other two examples (struct a and struct b) which are accepted
this code should probably be legal. Even if it is illegal the error message
is wrong.

>How-To-Repeat:
See description above.
>Fix:
A workaround is to move the volatile keyword before the struct.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-12-12  0:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-11 15:46 c/8420: volatile after the type specifier for an unnamed structure is rejected Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2002-12-11 16:36 Christian Ehrhardt
2002-12-02 13:09 bangerth
2002-11-01  2:16 ehrhardt

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).