public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65211] New: Type alignment lost inside templated function
@ 2015-02-25 16:47 linux at carewolf dot com
  2015-02-25 16:49 ` [Bug c++/65211] " linux at carewolf dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: linux at carewolf dot com @ 2015-02-25 16:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

            Bug ID: 65211
           Summary: Type alignment lost inside templated function
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linux at carewolf dot com

Created attachment 34871
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34871&action=edit
C++ source

A specific combination of local typedef inside a templated function causes gcc
to lose or ignore the aligment of a vector.


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

* [Bug c++/65211] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
@ 2015-02-25 16:49 ` linux at carewolf dot com
  2015-02-25 16:51 ` linux at carewolf dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: linux at carewolf dot com @ 2015-02-25 16:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #1 from Allan Jensen <linux at carewolf dot com> ---
Created attachment 34872
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34872&action=edit
Assembler intermediate

It is the "movdqa    (%rdx), %xmm1" instruction on line 19 that is wrong.


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

* [Bug c++/65211] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
  2015-02-25 16:49 ` [Bug c++/65211] " linux at carewolf dot com
@ 2015-02-25 16:51 ` linux at carewolf dot com
  2015-02-25 17:08 ` linux at carewolf dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: linux at carewolf dot com @ 2015-02-25 16:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #2 from Allan Jensen <linux at carewolf dot com> ---
Created attachment 34873
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34873&action=edit
Intermediate


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

* [Bug c++/65211] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
  2015-02-25 16:49 ` [Bug c++/65211] " linux at carewolf dot com
  2015-02-25 16:51 ` linux at carewolf dot com
@ 2015-02-25 17:08 ` linux at carewolf dot com
  2015-02-25 17:24 ` linux at carewolf dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: linux at carewolf dot com @ 2015-02-25 17:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Allan Jensen <linux at carewolf dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #34873|0                           |1
        is obsolete|                            |

--- Comment #3 from Allan Jensen <linux at carewolf dot com> ---
Created attachment 34875
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34875&action=edit
Correct intermediate


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

* [Bug c++/65211] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (2 preceding siblings ...)
  2015-02-25 17:08 ` linux at carewolf dot com
@ 2015-02-25 17:24 ` linux at carewolf dot com
  2021-12-05  6:45 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: linux at carewolf dot com @ 2015-02-25 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #4 from Allan Jensen <linux at carewolf dot com> ---
Note either removing the template argument or moving the typedef out of the
function both solve the issue, and makes gcc use an unaligned load.


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

* [Bug c++/65211] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (3 preceding siblings ...)
  2015-02-25 17:24 ` linux at carewolf dot com
@ 2021-12-05  6:45 ` pinskia at gcc dot gnu.org
  2021-12-05  6:56 ` [Bug c++/65211] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-05  6:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-05
     Ever confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, simplified testcase:
typedef unsigned v4ui __attribute__ ((vector_size(16), aligned (16)));
typedef unsigned v4ui_unaligned __attribute__ ((vector_size (16), aligned
(4)));
template<int I>
static v4ui t(unsigned *dest_data)
{
    return ((const v4ui_unaligned*)dest_data)[0];
}
template<int I>
static v4ui t1(unsigned *dest_data)
{
    typedef unsigned v4ui_1 __attribute__ ((vector_size (16), aligned (4)));
    return ((const v4ui_1*)dest_data)[0];
}
v4ui g(unsigned int *array)
{
    return t<1>(array+7);
}
v4ui f(unsigned int *array)
{
    return t1<1>(array+7);
}

Still a bug on the trunk even.

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

* [Bug c++/65211] [9/10/11/12 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (4 preceding siblings ...)
  2021-12-05  6:45 ` pinskia at gcc dot gnu.org
@ 2021-12-05  6:56 ` pinskia at gcc dot gnu.org
  2022-01-17 15:19 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-05  6:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Type alignment lost inside  |[9/10/11/12 Regression]
                   |templated function          |Type alignment lost inside
                   |                            |templated function
      Known to fail|                            |4.1.2, 4.5.3
      Known to work|                            |4.4.7
   Target Milestone|---                         |9.5

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

* [Bug c++/65211] [9/10/11/12 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (5 preceding siblings ...)
  2021-12-05  6:56 ` [Bug c++/65211] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-17 15:19 ` rguenth at gcc dot gnu.org
  2022-04-14  1:58 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 15:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/65211] [9/10/11/12 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (6 preceding siblings ...)
  2022-01-17 15:19 ` rguenth at gcc dot gnu.org
@ 2022-04-14  1:58 ` jason at gcc dot gnu.org
  2022-04-14  2:56 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-14  1:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org

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

* [Bug c++/65211] [9/10/11/12 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (7 preceding siblings ...)
  2022-04-14  1:58 ` jason at gcc dot gnu.org
@ 2022-04-14  2:56 ` cvs-commit at gcc dot gnu.org
  2022-04-26  7:54 ` [Bug c++/65211] [9/10/11 " cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-14  2:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:8369b4e4c6433535981d377edc1d4abb799c9225

commit r12-8153-g8369b4e4c6433535981d377edc1d4abb799c9225
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 13 21:56:03 2022 -0400

    c++: alignment of local typedef in template [PR65211]

    Because common_handle_aligned_attribute only applies the alignment to the
    TREE_TYPE of a typedef, not the DECL_ORIGINAL_TYPE, we need to copy it
    explicitly in tsubst.

            PR c++/65211

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/vec-tmpl1.C: New test.

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

* [Bug c++/65211] [9/10/11 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (8 preceding siblings ...)
  2022-04-14  2:56 ` cvs-commit at gcc dot gnu.org
@ 2022-04-26  7:54 ` cvs-commit at gcc dot gnu.org
  2022-05-13 16:28 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-26  7:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1b45ae16fffc856b5d84aeea12040dd82452cd07

commit r12-8262-g1b45ae16fffc856b5d84aeea12040dd82452cd07
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 26 09:52:22 2022 +0200

    testsuite: Fix up g++.target/i386/vec-tmpl1.C testcase [PR65211]

    This test fails on i686-linux:
    Excess errors:
    .../gcc/testsuite/g++.target/i386/vec-tmpl1.C:13:27: warning: SSE vector
return without SSE enabled changes the ABI [-Wpsabi]

    2022-04-26  Jakub Jelinek  <jakub@redhat.com>

            PR c++/65211
            * g++.target/i386/vec-tmpl1.C: Add -Wno-psabi as
            dg-additional-options.

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

* [Bug c++/65211] [9/10/11 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (9 preceding siblings ...)
  2022-04-26  7:54 ` [Bug c++/65211] [9/10/11 " cvs-commit at gcc dot gnu.org
@ 2022-05-13 16:28 ` cvs-commit at gcc dot gnu.org
  2022-05-13 17:14 ` [Bug c++/65211] [9/10 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 16:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:e60f7127b3282e0201a1bba8ff550dc3c3fdbe61

commit r11-9993-ge60f7127b3282e0201a1bba8ff550dc3c3fdbe61
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 13 21:56:03 2022 -0400

    c++: alignment of local typedef in template [PR65211]

    Because common_handle_aligned_attribute only applies the alignment to the
    TREE_TYPE of a typedef, not the DECL_ORIGINAL_TYPE, we need to copy it
    explicitly in tsubst.

            PR c++/65211

    gcc/cp/ChangeLog:

            * pt.c (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/vec-tmpl1.C: New test.

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

* [Bug c++/65211] [9/10 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (10 preceding siblings ...)
  2022-05-13 16:28 ` cvs-commit at gcc dot gnu.org
@ 2022-05-13 17:14 ` cvs-commit at gcc dot gnu.org
  2022-05-13 17:42 ` [Bug c++/65211] [9 " cvs-commit at gcc dot gnu.org
  2022-05-13 17:59 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 17:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:4b0c04f6b1c96f9baa7620c152b28e723212f955

commit r10-10738-g4b0c04f6b1c96f9baa7620c152b28e723212f955
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 13 21:56:03 2022 -0400

    c++: alignment of local typedef in template [PR65211]

    Because common_handle_aligned_attribute only applies the alignment to the
    TREE_TYPE of a typedef, not the DECL_ORIGINAL_TYPE, we need to copy it
    explicitly in tsubst.

            PR c++/65211

    gcc/cp/ChangeLog:

            * pt.c (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/vec-tmpl1.C: New test.

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

* [Bug c++/65211] [9 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (11 preceding siblings ...)
  2022-05-13 17:14 ` [Bug c++/65211] [9/10 " cvs-commit at gcc dot gnu.org
@ 2022-05-13 17:42 ` cvs-commit at gcc dot gnu.org
  2022-05-13 17:59 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 17:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2a9658132c449e48e1c3532190c8ab72f4bbe788

commit r9-10175-g2a9658132c449e48e1c3532190c8ab72f4bbe788
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 13 21:56:03 2022 -0400

    c++: alignment of local typedef in template [PR65211]

    Because common_handle_aligned_attribute only applies the alignment to the
    TREE_TYPE of a typedef, not the DECL_ORIGINAL_TYPE, we need to copy it
    explicitly in tsubst.

            PR c++/65211

    gcc/cp/ChangeLog:

            * pt.c (tsubst_decl) [TYPE_DECL]: Copy TYPE_ALIGN.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/vec-tmpl1.C: New test.

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

* [Bug c++/65211] [9 Regression] Type alignment lost inside templated function
  2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
                   ` (12 preceding siblings ...)
  2022-05-13 17:42 ` [Bug c++/65211] [9 " cvs-commit at gcc dot gnu.org
@ 2022-05-13 17:59 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-13 17:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65211

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 9.5/10.4/11.4/12.

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

end of thread, other threads:[~2022-05-13 17:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 16:47 [Bug c++/65211] New: Type alignment lost inside templated function linux at carewolf dot com
2015-02-25 16:49 ` [Bug c++/65211] " linux at carewolf dot com
2015-02-25 16:51 ` linux at carewolf dot com
2015-02-25 17:08 ` linux at carewolf dot com
2015-02-25 17:24 ` linux at carewolf dot com
2021-12-05  6:45 ` pinskia at gcc dot gnu.org
2021-12-05  6:56 ` [Bug c++/65211] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-17 15:19 ` rguenth at gcc dot gnu.org
2022-04-14  1:58 ` jason at gcc dot gnu.org
2022-04-14  2:56 ` cvs-commit at gcc dot gnu.org
2022-04-26  7:54 ` [Bug c++/65211] [9/10/11 " cvs-commit at gcc dot gnu.org
2022-05-13 16:28 ` cvs-commit at gcc dot gnu.org
2022-05-13 17:14 ` [Bug c++/65211] [9/10 " cvs-commit at gcc dot gnu.org
2022-05-13 17:42 ` [Bug c++/65211] [9 " cvs-commit at gcc dot gnu.org
2022-05-13 17:59 ` jason at gcc dot gnu.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).