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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread

end of thread, other threads:[~2004-12-29 19:05 UTC | newest]

Thread overview: 9+ 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

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