public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19163] New: __attribute__((aligned)) not working in template
@ 2004-12-27 11:25 pcarlini at suse dot de
  2004-12-27 11:26 ` [Bug c++/19163] " pcarlini at suse dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-27 11:25 UTC (permalink / raw)
  To: gcc-bugs

Unfortunately, it looks like even the very limited functionality of aligned vs
template (see, e.g., c++/17743) is broken and I cannot even attempt implementing
tr1::type_traits::aligned_storage: the attribute seems completely ignored,
otherwise I could at least provide specializations for Align = 1,2,4,8,16...

Needless to say, Icc seems ok :(

Testcase (but, in case please test partial specializations too!):

//////////////

struct A
{ typedef char type[4] __attribute__((aligned(4))); };

template<unsigned _Len>
  struct B
  { typedef char type[_Len] __attribute__((aligned(4))); };

template<bool> struct StaticAssert;
template<> struct StaticAssert<true> {};

StaticAssert<__alignof__(A::type) == __alignof__(B<4>::type)> a1;
StaticAssert<__alignof__(B<4>::type) == 4> a2;

/////////////////

Giovanni can you please have a look?!? Thanks!

-- 
           Summary: __attribute__((aligned)) not working in template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: giovannibajo at libero dot it
        ReportedBy: pcarlini at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
@ 2004-12-27 11:26 ` pcarlini at suse dot de
  2004-12-27 13:18 ` giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-27 11:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at integrable-solutions
                   |                            |dot net


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
  2004-12-27 11:26 ` [Bug c++/19163] " pcarlini at suse dot de
@ 2004-12-27 13:18 ` giovannibajo at libero dot it
  2004-12-27 13:24 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-27 13:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-12-27 13:18 -------
We lose the alignment while tsubsting. This is a quick patch for this, I'm not 
sure if there are other information we should propagate from the original array 
type to the new array type, I guess the reviewer will know.

Meanwhile, Paolo, mind if I ask you to test this patch for me? You can also 
test the partial specialization, it looks like it works for me.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-27 13:18:18
               date|                            |


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
  2004-12-27 11:26 ` [Bug c++/19163] " pcarlini at suse dot de
  2004-12-27 13:18 ` giovannibajo at libero dot it
@ 2004-12-27 13:24 ` pcarlini at suse dot de
  2004-12-27 15:45 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-27 13:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-12-27 13:24 -------
> Meanwhile, Paolo, mind if I ask you to test this patch for me? You can also 
> test the partial specialization, it looks like it works for me.

Sure, I will: expect some feedback from me before the end of the day! Thank
you very much for the quick help!!



-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
                   ` (2 preceding siblings ...)
  2004-12-27 13:24 ` pcarlini at suse dot de
@ 2004-12-27 15:45 ` pcarlini at suse dot de
  2004-12-27 15:46 ` pcarlini at suse dot de
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-27 15:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-12-27 15:45 -------
Hi again! Yes, I can confirm that the patch works fine here: regtests ok and
both the above testcase and the below pass with it, which basically amounts
to making possible a decent implementation of tr1::type_traits::aligned_storage
Thanks Giovanni! Please post your complete work ASAP and let's have this fixed
for 4.0 too, if possible!

//////////////////

struct A
{ typedef char type[4] __attribute__((aligned(4))); };

template<unsigned, unsigned>
  struct B;

template<unsigned _Len>
  struct B<_Len, 4>
  { typedef char type[_Len] __attribute__((aligned(4))); };

template<bool> struct StaticAssert;
template<> struct StaticAssert<true> {};

StaticAssert<__alignof__(A::type) == __alignof__(B<4, 4>::type)> a1;
StaticAssert<__alignof__(B<4, 4>::type) == 4> a2;

//////////////////

-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
                   ` (3 preceding siblings ...)
  2004-12-27 15:45 ` pcarlini at suse dot de
@ 2004-12-27 15:46 ` pcarlini at suse dot de
  2004-12-27 22:07 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-27 15:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-12-27 15:46 -------
... forgot to specify: regtested on x86_64-linux.

-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
                   ` (4 preceding siblings ...)
  2004-12-27 15:46 ` pcarlini at suse dot de
@ 2004-12-27 22:07 ` giovannibajo at libero dot it
  2004-12-29 18:57 ` gdr at integrable-solutions dot net
  2004-12-29 19:05 ` pcarlini at suse dot de
  7 siblings, 0 replies; 16+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-27 22:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-12-27 22:07 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01975.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
                   ` (5 preceding siblings ...)
  2004-12-27 22:07 ` giovannibajo at libero dot it
@ 2004-12-29 18:57 ` gdr at integrable-solutions dot net
  2004-12-29 19:05 ` pcarlini at suse dot de
  7 siblings, 0 replies; 16+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-12-29 18:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-12-29 18:57 -------
Subject: Re:  New: __attribute__((aligned)) not working in template

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| Unfortunately, it looks like even the very limited functionality of aligned vs
| template (see, e.g., c++/17743) is broken and I cannot even attempt implementing
| tr1::type_traits::aligned_storage: the attribute seems completely ignored,
| otherwise I could at least provide specializations for Align = 1,2,4,8,16...

Did I already open a PR for this misbehaviour in the past?  What
happened?

-- Gaby


-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
  2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
                   ` (6 preceding siblings ...)
  2004-12-29 18:57 ` gdr at integrable-solutions dot net
@ 2004-12-29 19:05 ` pcarlini at suse dot de
  7 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-12-29 19:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-12-29 19:05 -------
> Did I already open a PR for this misbehaviour in the past?  What
> happened?

Yes, Gaby, the issue at large is clear, by now: see c++/17743. Here, we are
just trying to achieve *minimal* functionality, when the espression in the
attribute is not dependent: among other things (currently __align__ inside
templates is *totally* broken :( this would allow me to provide a decent first
implementation of aligned_storage via specializations for Align=1,2,4,8,16
There is an updated patch ready, which seems to me rather safe

  http://gcc.gnu.org/ml/gcc-patches/2004-12/msg02003.html

Paolo.

-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2007-09-06 21:01 ` bkoz at gcc dot gnu dot org
@ 2007-09-22 14:29 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-22 14:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from jason at gcc dot gnu dot org  2007-09-22 14:28 -------
Fixed for 4.3.0.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|4.3.0                       |
      Known to work|                            |4.3.0
         Resolution|                            |FIXED


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2007-09-06  8:15 ` nathan at codesourcery dot com
@ 2007-09-06 21:01 ` bkoz at gcc dot gnu dot org
  2007-09-22 14:29 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-09-06 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from bkoz at gcc dot gnu dot org  2007-09-06 21:00 -------

Yo!

Jason, fixing this would be most appreciated by the library hackers. This is
one of those things that I would really like to see implemented before C++0x
gets too far down the road... there is a bunch of stuff depending on this, from
both C++0x and TR1.

Also, I believe that the deprecated attribute issue is also related to some of
these issues.

Those bugzilla numbas are:

15269
16370

best,
benjamin


-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-09-06  6:17 ` mark at codesourcery dot com
@ 2007-09-06  8:15 ` nathan at codesourcery dot com
  2007-09-06 21:01 ` bkoz at gcc dot gnu dot org
  2007-09-22 14:29 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: nathan at codesourcery dot com @ 2007-09-06  8:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from nathan at codesourcery dot com  2007-09-06 08:15 -------
Subject: Re:  __attribute__((aligned)) not working in template

mark at codesourcery dot com wrote:

> I don't think so, but I'm not quite sure I understand.  Anyhow, I'm sure
> I don't have any uncontributed patches for this, and I don't think
> Nathan has either.

I do not.  I remember looking at it, but didn't get anywhere.

nathan


-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-09-06  6:11 ` jason at gcc dot gnu dot org
@ 2007-09-06  6:17 ` mark at codesourcery dot com
  2007-09-06  8:15 ` nathan at codesourcery dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: mark at codesourcery dot com @ 2007-09-06  6:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from mark at codesourcery dot com  2007-09-06 06:16 -------
Subject: Re:  __attribute__((aligned)) not working in template

jason at gcc dot gnu dot org wrote:
> ------- Comment #10 from jason at gcc dot gnu dot org  2007-09-06 05:50 -------
> Vague references:
> 
> http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00247.html
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17743
> 
> Seems like Mark and/or Nathan have/had state on this that they haven't shared
> with the lists.

I don't think so, but I'm not quite sure I understand.  Anyhow, I'm sure
I don't have any uncontributed patches for this, and I don't think
Nathan has either.


-- 


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
  2005-10-06  6:44 ` giovannibajo at libero dot it
  2007-09-06  5:51 ` jason at gcc dot gnu dot org
@ 2007-09-06  6:11 ` jason at gcc dot gnu dot org
  2007-09-06  6:17 ` mark at codesourcery dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-06  6:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-01-15 21:09:09         |2007-09-06 06:11:31
               date|                            |


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
  2005-10-06  6:44 ` giovannibajo at libero dot it
@ 2007-09-06  5:51 ` jason at gcc dot gnu dot org
  2007-09-06  6:11 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-06  5:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jason at gcc dot gnu dot org  2007-09-06 05:50 -------
Vague references:

http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00247.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17743

Seems like Mark and/or Nathan have/had state on this that they haven't shared
with the lists.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at codesourcery dot
                   |                            |com
OtherBugsDependingO|                            |17743
              nThis|                            |
      Known to fail|                            |4.3.0


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


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

* [Bug c++/19163] __attribute__((aligned)) not working in template
       [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
@ 2005-10-06  6:44 ` giovannibajo at libero dot it
  2007-09-06  5:51 ` jason at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: giovannibajo at libero dot it @ 2005-10-06  6:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from giovannibajo at libero dot it  2005-10-06 06:44 -------
The patch was rejected. Not working on this anymore.


-- 

giovannibajo at libero dot it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|giovannibajo at libero dot  |unassigned at gcc dot gnu
                   |it                          |dot org


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


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

end of thread, other threads:[~2007-09-22 14:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-27 11:25 [Bug c++/19163] New: __attribute__((aligned)) not working in template pcarlini at suse dot de
2004-12-27 11:26 ` [Bug c++/19163] " pcarlini at suse dot de
2004-12-27 13:18 ` giovannibajo at libero dot it
2004-12-27 13:24 ` pcarlini at suse dot de
2004-12-27 15:45 ` pcarlini at suse dot de
2004-12-27 15:46 ` pcarlini at suse dot de
2004-12-27 22:07 ` giovannibajo at libero dot it
2004-12-29 18:57 ` gdr at integrable-solutions dot net
2004-12-29 19:05 ` pcarlini at suse dot de
     [not found] <bug-19163-133@http.gcc.gnu.org/bugzilla/>
2005-10-06  6:44 ` giovannibajo at libero dot it
2007-09-06  5:51 ` jason at gcc dot gnu dot org
2007-09-06  6:11 ` jason at gcc dot gnu dot org
2007-09-06  6:17 ` mark at codesourcery dot com
2007-09-06  8:15 ` nathan at codesourcery dot com
2007-09-06 21:01 ` bkoz at gcc dot gnu dot org
2007-09-22 14:29 ` jason 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).