public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7585: Attributes for nested typedef-name ignored
@ 2002-08-13  9:36 gdr
  0 siblings, 0 replies; 6+ messages in thread
From: gdr @ 2002-08-13  9:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7585
>Category:       c++
>Synopsis:       Attributes for nested typedef-name ignored
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 13 07:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gabriel Dos Reis <gdr@nerim.net>
>Release:        unknown-1.0
>Organization:
>Environment:
Plateform independent
>Description:
cc1plus ignores attributes for nested typedef-names.
This seems to happen only for typedef-names.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="alignof-nested-type.C"
Content-Disposition: inline; filename="alignof-nested-type.C"

#include <stdio.h>

struct A {
    struct X { } __attribute__((__aligned__(__alignof__(int))));
    typedef struct { } Y __attribute__((__aligned__(__alignof__(int))));
};


int main()
{
    printf("alignof(A::X) = %d;\t should be %d\n",
	   __alignof__(A::X), __alignof__(int));
    printf("alignof(A::Y) = %d;\t should be %d\n",
	   __alignof__(A::Y), __alignof__(int));
}


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

* Re: c++/7585: Attributes for nested typedef-name ignored
@ 2002-10-31 11:26 Joseph S. Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph S. Myers @ 2002-10-31 11:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: <gcc-bugs@gcc.gnu.org>,  <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7585: Attributes for nested typedef-name ignored
Date: Thu, 31 Oct 2002 19:16:35 +0000 (GMT)

 On Thu, 31 Oct 2002, Wolfgang Bangerth wrote:
 
 > > Said differently, what do you envision for the "right" syntax for
 > > 
 > >    typedef unsigned char type[sizeof(int)] 
 > >              __attribute__((__aligned__(__alignof__(int))));
 
 typedef unsigned char
     (__attribute__((__aligned__(__alignof__(int)))) type)[sizeof(int)]
 
 (supposing that the attribute is to be applied to the array type).
 
 > I think it would help to have a formal specification of attribute 
 > placement somewhere. Although it would probably be so complicated that 
 > nobody would want to read it...
 
 "Attribute Syntax" in the manual.  It does presume you fully understand
 the formal definition in the C standard of declarator syntax, before you
 can understand how it is extended with attributes.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


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

* Re: c++/7585: Attributes for nested typedef-name ignored
@ 2002-10-31  9:16 Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-10-31  9:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7585: Attributes for nested typedef-name ignored
Date: 31 Oct 2002 18:01:29 +0100

 Wolfgang Bangerth <bangerth@ticam.utexas.edu> writes:
 
 [...]
 
 | I think it would help to have a formal specification of attribute 
 | placement somewhere.
 
 Definitely.  And the GCC documentation has wording to that effect.
 
 -- Gaby


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

* Re: c++/7585: Attributes for nested typedef-name ignored
@ 2002-10-31  7:26 Wolfgang Bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Bangerth @ 2002-10-31  7:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7585: Attributes for nested typedef-name ignored
Date: Thu, 31 Oct 2002 09:21:27 -0600 (CST)

 > |     I can see this as well, but I imagine the syntax is wrong:
 > |     shouldn't it be
 > |         typedef struct { } __attribute__((__aligned__(__alignof__(int)))) Y;
 > |     
 > |     instead of
 > |     
 > |         typedef struct { } Y __attribute__((__aligned__(__alignof__(int))));
 > |     
 > |     ??
 > 
 > Maybe.  But then, I think __alignof__(Y) should return
 > __alignof__(int) if the attribute is being applied to Y.
 > 
 > Said differently, what do you envision for the "right" syntax for
 > 
 >    typedef unsigned char type[sizeof(int)] 
 >              __attribute__((__aligned__(__alignof__(int))));
 
 I have no clue. I think that the weird C declaration syntax is probably 
 just not suited for the application of attributes.
 
 And maybe it's simpler to understand if you make up the typedef in steps, 
 say
   typedef unsigned char array[...]
   typedef aligne_array __attribute__(...) aligned_array;
 (or the attributes somewhere else).
 
 I think it would help to have a formal specification of attribute 
 placement somewhere. Although it would probably be so complicated that 
 nobody would want to read it...
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


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

* Re: c++/7585: Attributes for nested typedef-name ignored
@ 2002-10-30 20:16 Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-10-30 20:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: bangerth@dealii.org
Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/7585: Attributes for nested typedef-name ignored
Date: 31 Oct 2002 05:05:27 +0100

 bangerth@dealii.org writes:
 
 | Synopsis: Attributes for nested typedef-name ignored
 | 
 | State-Changed-From-To: open->analyzed
 | State-Changed-By: bangerth
 | State-Changed-When: Wed Oct 30 16:32:50 2002
 | State-Changed-Why:
 |     I can see this as well, but I imagine the syntax is wrong:
 |     shouldn't it be
 |         typedef struct { } __attribute__((__aligned__(__alignof__(int)))) Y;
 |     
 |     instead of
 |     
 |         typedef struct { } Y __attribute__((__aligned__(__alignof__(int))));
 |     
 |     ??
 
 Maybe.  But then, I think __alignof__(Y) should return
 __alignof__(int) if the attribute is being applied to Y.
 
 Said differently, what do you envision for the "right" syntax for
 
    typedef unsigned char type[sizeof(int)] 
              __attribute__((__aligned__(__alignof__(int))));
 
 ?
 
 -- Gaby


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

* Re: c++/7585: Attributes for nested typedef-name ignored
@ 2002-10-30 16:32 bangerth
  0 siblings, 0 replies; 6+ messages in thread
From: bangerth @ 2002-10-30 16:32 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gdr, nobody

Synopsis: Attributes for nested typedef-name ignored

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Oct 30 16:32:50 2002
State-Changed-Why:
    I can see this as well, but I imagine the syntax is wrong:
    shouldn't it be
        typedef struct { } __attribute__((__aligned__(__alignof__(int)))) Y;
    
    instead of
    
        typedef struct { } Y __attribute__((__aligned__(__alignof__(int))));
    
    ??
    With this, the output is as you expect.

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


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

end of thread, other threads:[~2002-10-31 19:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13  9:36 c++/7585: Attributes for nested typedef-name ignored gdr
2002-10-30 16:32 bangerth
2002-10-30 20:16 Gabriel Dos Reis
2002-10-31  7:26 Wolfgang Bangerth
2002-10-31  9:16 Gabriel Dos Reis
2002-10-31 11:26 Joseph S. Myers

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