public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17743] New: __alignof__ vs. typedefs
@ 2004-09-30  4:26 bkoz at gcc dot gnu dot org
  2004-09-30  4:28 ` [Bug c++/17743] " bkoz at gcc dot gnu dot org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:26 UTC (permalink / raw)
  To: gcc-bugs

Typedefs are stripping __alignof__ information. This is prohibiting work on
TR1's aligned_storage. Which libstdc++ would like to use, both within the
library and to implement a fixed-size, zero-allocation allocator for STL and
string containers.

Details here:
http://gcc.gnu.org/ml/libstdc++/2004-09/msg00255.html

-benjamin

-- 
           Summary: __alignof__ vs. typedefs
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
                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=17743


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
@ 2004-09-30  4:28 ` bkoz at gcc dot gnu dot org
  2004-09-30  4:29 ` bkoz at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-09-30 04:28 -------
Created an attachment (id=7244)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7244&action=view)
test case

test case

-- 


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
  2004-09-30  4:28 ` [Bug c++/17743] " bkoz at gcc dot gnu dot org
@ 2004-09-30  4:29 ` bkoz at gcc dot gnu dot org
  2004-09-30  4:30 ` bkoz at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:29 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at cs dot tamu dot edu,
                   |                            |mark at codesourcery dot com


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
  2004-09-30  4:28 ` [Bug c++/17743] " bkoz at gcc dot gnu dot org
  2004-09-30  4:29 ` bkoz at gcc dot gnu dot org
@ 2004-09-30  4:30 ` bkoz at gcc dot gnu dot org
  2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-09-30 04:30 -------
Add deps...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |8670
              nThis|                            |


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-30  4:30 ` bkoz at gcc dot gnu dot org
@ 2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
  2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 3.4.1 3.4.2 4.0.0     |3.3.3 3.4.0 3.4.1 3.4.2
                   |                            |4.0.0


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
@ 2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
  2004-09-30  4:45 ` pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-09-30  4:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.0 3.4.1 3.4.2 4.0.0


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
@ 2004-09-30  4:45 ` pinskia at gcc dot gnu dot org
  2004-09-30  4:47 ` pinskia at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-30  4:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-30 04:45 -------
Actually this is the attribute aligned vs arrays.

I cannot decode what the documenation means:
Note that although you can ask the compiler to select a time-efficient alignment for a given type and 
then declare only individual stand-alone objects of that type, the compiler's ability to select a time-
efficient alignment is primarily useful only when you plan to create arrays of variables having the 
relevant (efficiently aligned) type. If you declare or use arrays of variables of an efficiently-aligned type, 
then it is likely that your program will also be doing pointer arithmetic (or subscripting, which amounts 
to the same thing) on pointers to the relevant type, and the code that the compiler generates for these 
pointer arithmetic operations will often be more efficient for efficiently-aligned types than for other 
types.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|8670                        |
              nThis|                            |
      Known to fail|3.3.3 3.4.0 3.4.1 3.4.2     |
                   |4.0.0                       |


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-09-30  4:45 ` pinskia at gcc dot gnu dot org
@ 2004-09-30  4:47 ` pinskia at gcc dot gnu dot org
  2004-09-30 11:12 ` gdr at cs dot tamu dot edu
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-30  4:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-30 04:47 -------
Revert back some changes that I did not mean to do.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |8670
              nThis|                            |
      Known to fail|                            |3.3.3 3.4.0 3.4.1 3.4.2
                   |                            |4.0.0


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-09-30  4:47 ` pinskia at gcc dot gnu dot org
@ 2004-09-30 11:12 ` gdr at cs dot tamu dot edu
  2004-09-30 12:27 ` giovannibajo at libero dot it
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: gdr at cs dot tamu dot edu @ 2004-09-30 11:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at cs dot tamu dot edu  2004-09-30 11:12 -------
Subject: Re:  __alignof__ vs. typedefs

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Actually this is the attribute aligned vs arrays.
| 
| I cannot decode what the documenation means:
| Note that although you can ask the compiler to select a
| time-efficient alignment for a given type and  
| then declare only individual stand-alone objects of that type, the
| compiler's ability to select a time- 
| efficient alignment is primarily useful only when you plan to create
| arrays of variables having the  
| relevant (efficiently aligned) type. If you declare or use arrays of
| variables of an efficiently-aligned type,  
| then it is likely that your program will also be doing pointer
| arithmetic (or subscripting, which amounts  
| to the same thing) on pointers to the relevant type, and the code
| that the compiler generates for these  
| pointer arithmetic operations will often be more efficient for
| efficiently-aligned types than for other types.

I don't see how much this is relevant to the different uses of the
aligned attribute in the library.  Right now, the compiler is just
ignoring the aligned attribute.  We're more intersted in the semantics
than in the speed.

What we want is to align a given *array object* at some alignment
boundaries.  We're not interested in pointer arithmetics on array
types or speed -- although we may be doing pointer arithmetic on
individual elements of the array, but that is a separate issue.
The primarily thing is the ability to align an array object on a given
boundary. 

-- Gaby


-- 


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-09-30 11:12 ` gdr at cs dot tamu dot edu
@ 2004-09-30 12:27 ` giovannibajo at libero dot it
  2004-09-30 14:48 ` bkoz at redhat dot com
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-30 12:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-30 12:27 -------
Benj, having a fix in time for 4.0 would help, or is it going to be 4.1 
material anyway?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-09-30 12:27 ` giovannibajo at libero dot it
@ 2004-09-30 14:48 ` bkoz at redhat dot com
  2004-10-15  1:49 ` giovannibajo at libero dot it
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at redhat dot com @ 2004-09-30 14:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at redhat dot com  2004-09-30 14:48 -------
Subject: Re:  __alignof__ vs. typedefs


>Benj, having a fix in time for 4.0 would help, or is it going to be 4.1 
>material anyway?

Having a fix for this for 4.0.0 will definitely be useful. I'm kind of
surprised that this isn't working right now, actually: I thought it was.
See libstdc++-v3/src/globals*.cc.

If somebody wants to change the subjet to something better go for it.

-benjamin


-- 


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-09-30 14:48 ` bkoz at redhat dot com
@ 2004-10-15  1:49 ` giovannibajo at libero dot it
  2004-10-16  2:00 ` giovannibajo at libero dot it
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-15  1:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |giovannibajo at libero dot
                   |dot org                     |it
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-15 01:49:31
               date|                            |


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-10-15  1:49 ` giovannibajo at libero dot it
@ 2004-10-16  2:00 ` giovannibajo at libero dot it
  2004-10-16  3:37 ` mark at codesourcery dot com
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-16  2:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-16 02:00 -------
Patch submitted:
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01320.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2004-10-16  2:00 ` giovannibajo at libero dot it
@ 2004-10-16  3:37 ` mark at codesourcery dot com
  2004-10-16 13:52 ` bkoz at redhat dot com
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: mark at codesourcery dot com @ 2004-10-16  3:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2004-10-16 03:37 -------
Subject: Re:  __alignof__ vs. typedefs

giovannibajo at libero dot it wrote:

>------- Additional Comments From giovannibajo at libero dot it  2004-10-16 02:00 -------
>Patch submitted:
>http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01320.html
>  
>
OK.  But XFAIL the tr1 test cases so those do not show up as new FAILs.



-- 


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2004-10-16  3:37 ` mark at codesourcery dot com
@ 2004-10-16 13:52 ` bkoz at redhat dot com
  2004-10-17  4:39 ` cvs-commit at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at redhat dot com @ 2004-10-16 13:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at redhat dot com  2004-10-16 13:52 -------
Subject: Re:  __alignof__ vs. typedefs


>OK.  But XFAIL the tr1 test cases so those do not show up as new FAILs.

I think I just took care of this. 

Giovanni, thanks!

-benjamin


-- 


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


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

* [Bug c++/17743] __alignof__ vs. typedefs
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2004-10-16 13:52 ` bkoz at redhat dot com
@ 2004-10-17  4:39 ` cvs-commit at gcc dot gnu dot org
  2004-10-17  4:48 ` [Bug c++/17743] dependent expressions in attributes giovannibajo at libero dot it
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-17  4:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-17 04:39 -------
Subject: Bug 17743

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2004-10-17 04:39:46

Modified files:
	gcc/cp         : ChangeLog decl2.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: attrib17.C 

Log message:
	PR c++/17743
	* decl2.c (grokfield): Apply attributes also to TYPE_DECLs.
	
	PR c++/17743
	* g++.dg/ext/attrib17.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4440&r2=1.4441
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.753&r2=1.754
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4463&r2=1.4464
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib17.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2004-10-17  4:39 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-17  4:48 ` giovannibajo at libero dot it
  2004-10-17  7:50 ` gdr at cs dot tamu dot edu
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-17  4:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-17 04:47 -------
OK, I fixed part of this for 4.0. The missing part is when the expression in 
attributes is dependent, like:

template <class T>
struct A {
    char foo __attribute__((aligned(__alignof__(T))));
};

This is non-trivial to fix. Benjamin, if you want you can keep this bugreport 
open to track this. I do not plan to be able to fix this in the 4.0 timeframe, 
so I have unassigned the bug (I will attempt something though). If somebody 
more expert than me wants to help the v3 guys, feel free.

Otherwise, if you do not care about this, just close this bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|giovannibajo at libero dot  |unassigned at gcc dot gnu
                   |it                          |dot org
             Status|ASSIGNED                    |NEW
            Summary|__alignof__ vs. typedefs    |dependent expressions in
                   |                            |attributes


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2004-10-17  4:48 ` [Bug c++/17743] dependent expressions in attributes giovannibajo at libero dot it
@ 2004-10-17  7:50 ` gdr at cs dot tamu dot edu
  2004-10-18  3:51 ` giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: gdr at cs dot tamu dot edu @ 2004-10-17  7:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at cs dot tamu dot edu  2004-10-17 07:50 -------
Subject: Re:  dependent expressions in attributes

On Sat, 17 Oct 2004, giovannibajo at libero dot it wrote:

| OK, I fixed part of this for 4.0. The missing part is when the expression in
| attributes is dependent, like:
|
| template <class T>
| struct A {
|     char foo __attribute__((aligned(__alignof__(T))));
| };
|
| This is non-trivial to fix. Benjamin, if you want you can keep this bugreport
| open to track this. I do not plan to be able to fix this in the 4.0 timeframe,
| so I have unassigned the bug (I will attempt something though). If somebody
| more expert than me wants to help the v3 guys, feel free.
|
| Otherwise, if you do not care about this, just close this bug.

I do care.

-- Gaby


-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2004-10-17  7:50 ` gdr at cs dot tamu dot edu
@ 2004-10-18  3:51 ` giovannibajo at libero dot it
  2004-10-18  5:23 ` bkoz at redhat dot com
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-18  3:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-18 03:51 -------
Subject: Re:  dependent expressions in attributes

>> template <class T>
>> struct A {
>>     char foo __attribute__((aligned(__alignof__(T))));
>> };
> 
> I do care.

Is this a showstopper for tr1 work?

Giovanni Bajo




-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (17 preceding siblings ...)
  2004-10-18  3:51 ` giovannibajo at libero dot it
@ 2004-10-18  5:23 ` bkoz at redhat dot com
  2004-10-18 16:38 ` giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at redhat dot com @ 2004-10-18  5:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at redhat dot com  2004-10-18 05:23 -------
Subject: Re:  dependent expressions in attributes


>Is this a showstopper for tr1 work?
 
Not that I can see. From what I can tell, tr1::array is going to require
default-constructable types. 

I think the library hackers are interested in this kind of stuff for our
own selfish reasons.

I guess I don't see why/how alignof should be different than sizeof
here (which works):

 template <class T>
 struct A 
 {
   char foo[sizeof(T)];
 };

-benjamin


-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (18 preceding siblings ...)
  2004-10-18  5:23 ` bkoz at redhat dot com
@ 2004-10-18 16:38 ` giovannibajo at libero dot it
  2004-10-18 18:57 ` bkoz at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-18 16:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-18 16:38 -------
(In reply to comment #15)

> I guess I don't see why/how alignof should be different than sizeof
> here (which works):
>  template <class T>
>  struct A 
>  {
>    char foo[sizeof(T)];
>  };

Yes, but how do you force the compiler to ensure that the alignment of char foo
[] is sufficient to placement-allocate an object of type T into it?


-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (19 preceding siblings ...)
  2004-10-18 16:38 ` giovannibajo at libero dot it
@ 2004-10-18 18:57 ` bkoz at gcc dot gnu dot org
  2004-10-19  6:23 ` bkoz at redhat dot com
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-10-18 18:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-10-18 18:57 -------
Giovanni, this is applicable to TR1 via 

4.5.5 Other transformations [tr.meta.trans.other] template <std :: size_t Len ,
std :: size_t Align > struct aligned_storage { typedef unspecified type ; }; 1
type: an implementation defined POD type with size Len and alignment Align, and
suitable for use as uninitialized storage for any object of a type whose size is
Len and whose alignment is Align.

-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (20 preceding siblings ...)
  2004-10-18 18:57 ` bkoz at gcc dot gnu dot org
@ 2004-10-19  6:23 ` bkoz at redhat dot com
  2004-10-27 17:19 ` bkoz at gcc dot gnu dot org
  2004-10-28  3:38 ` giovannibajo at libero dot it
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at redhat dot com @ 2004-10-19  6:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at redhat dot com  2004-10-19 06:23 -------
Subject: Re:  dependent expressions in attributes


>Yes, but how do you force the compiler to ensure that the alignment of char foo
>[] is sufficient to placement-allocate an object of type T into it?

...get __alignof__(T) working?

I don't see any other way, really. 

-benjamin


-- 


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (21 preceding siblings ...)
  2004-10-19  6:23 ` bkoz at redhat dot com
@ 2004-10-27 17:19 ` bkoz at gcc dot gnu dot org
  2004-10-28  3:38 ` giovannibajo at libero dot it
  23 siblings, 0 replies; 25+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-10-27 17:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-10-27 17:19 -------

Jason, this is the bug I talked about briefly. Do you think the Redmond offsetof
work is also applicable here?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com


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


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

* [Bug c++/17743] dependent expressions in attributes
  2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
                   ` (22 preceding siblings ...)
  2004-10-27 17:19 ` bkoz at gcc dot gnu dot org
@ 2004-10-28  3:38 ` giovannibajo at libero dot it
  23 siblings, 0 replies; 25+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-28  3:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-28 03:38 -------
(In reply to comment #19)

> Jason, this is the bug I talked about briefly. Do you think
> the Redmond offsetof work is also applicable here?

Mind to share that?

-- 


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


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

end of thread, other threads:[~2004-10-28  3:38 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-30  4:26 [Bug c++/17743] New: __alignof__ vs. typedefs bkoz at gcc dot gnu dot org
2004-09-30  4:28 ` [Bug c++/17743] " bkoz at gcc dot gnu dot org
2004-09-30  4:29 ` bkoz at gcc dot gnu dot org
2004-09-30  4:30 ` bkoz at gcc dot gnu dot org
2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
2004-09-30  4:33 ` bkoz at gcc dot gnu dot org
2004-09-30  4:45 ` pinskia at gcc dot gnu dot org
2004-09-30  4:47 ` pinskia at gcc dot gnu dot org
2004-09-30 11:12 ` gdr at cs dot tamu dot edu
2004-09-30 12:27 ` giovannibajo at libero dot it
2004-09-30 14:48 ` bkoz at redhat dot com
2004-10-15  1:49 ` giovannibajo at libero dot it
2004-10-16  2:00 ` giovannibajo at libero dot it
2004-10-16  3:37 ` mark at codesourcery dot com
2004-10-16 13:52 ` bkoz at redhat dot com
2004-10-17  4:39 ` cvs-commit at gcc dot gnu dot org
2004-10-17  4:48 ` [Bug c++/17743] dependent expressions in attributes giovannibajo at libero dot it
2004-10-17  7:50 ` gdr at cs dot tamu dot edu
2004-10-18  3:51 ` giovannibajo at libero dot it
2004-10-18  5:23 ` bkoz at redhat dot com
2004-10-18 16:38 ` giovannibajo at libero dot it
2004-10-18 18:57 ` bkoz at gcc dot gnu dot org
2004-10-19  6:23 ` bkoz at redhat dot com
2004-10-27 17:19 ` bkoz at gcc dot gnu dot org
2004-10-28  3:38 ` giovannibajo at libero dot it

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