public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65734] New: Yet another case of lost alignment by stor_layout
@ 2015-04-10 18:49 hubicka at gcc dot gnu.org
2015-04-10 18:51 ` [Bug c++/65734] " hubicka at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-10 18:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
Bug ID: 65734
Summary: Yet another case of lost alignment by stor_layout
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
template <typename T>
struct BVector
{
typedef T T2;
typedef T value_type [[gnu::aligned(8)]]; // { dg-bogus "attribute"
"attribute" }
typedef T2 value_type2 [[gnu::aligned(8)]]; // { dg-bogus "attribute"
"attribute" }
value_type v;
};
BVector<int> m;
template <template <class> class T>
struct BV2
{
typedef T<float> value_type [[gnu::aligned(16)]]; // { dg-bogus "attribute"
"attribute" }
value_type v;
};
BV2<BVector> m2;
int
main()
{
if (__alignof__ (BV2<BVector>::value_type) != 16)
__builtin_abort ();
}
$ /aux/hubicka/trunk-install/bin/gcc -O2 a.C -std=gnu++11
$ ./a.out
Aborted
$ /aux/hubicka/llvm2-install/bin/clang -O2 a.C -std=gnu++11
$ ./a.out
$
I think we have problem with re-layouting the type here.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
@ 2015-04-10 18:51 ` hubicka at gcc dot gnu.org
2015-04-10 19:39 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-04-10 18:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |jakub at redhat dot com,
| |jason at redhat dot com
--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
With the following check in stor-laout.c
Index: stor-layout.c
===================================================================
--- stor-layout.c (revision 221977)
+++ stor-layout.c (working copy)
@@ -1831,6 +1831,8 @@ finalize_type_size (tree type)
{
TYPE_SIZE (variant) = size;
TYPE_SIZE_UNIT (variant) = size_unit;
+ if (TYPE_USER_ALIGN (variant))
+ gcc_assert (user_align && TYPE_ALIGN (variant) == align);
TYPE_ALIGN (variant) = align;
TYPE_PRECISION (variant) = precision;
TYPE_USER_ALIGN (variant) = user_align;
I get:
0xa87ace finalize_type_size
../../gcc/stor-layout.c:1835
0xa87bbe finish_record_layout(record_layout_info_s*, int)
../../gcc/stor-layout.c:2079
0x6454bc layout_class_type
../../gcc/cp/class.c:6468
0x6454bc finish_struct_1(tree_node*)
../../gcc/cp/class.c:6598
0x631f4e instantiate_class_template_1
../../gcc/cp/pt.c:9648
0x631f4e instantiate_class_template(tree_node*)
../../gcc/cp/pt.c:9688
0x68a20d complete_type(tree_node*)
../../gcc/cp/typeck.c:146
0x63216c instantiate_class_template_1
../../gcc/cp/pt.c:9469
0x63216c instantiate_class_template(tree_node*)
../../gcc/cp/pt.c:9688
0x68a20d complete_type(tree_node*)
../../gcc/cp/typeck.c:146
0x5f6876 start_decl_1(tree_node*, bool)
../../gcc/cp/decl.c:4900
0x60567f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/cp/decl.c:4863
0x67b646 cp_parser_init_declarator
../../gcc/cp/parser.c:17170
0x67cc1c cp_parser_simple_declaration
../../gcc/cp/parser.c:11607
0x666503 cp_parser_block_declaration
../../gcc/cp/parser.c:11481
0x6860b9 cp_parser_declaration
../../gcc/cp/parser.c:11378
0x6849aa cp_parser_declaration_seq_opt
../../gcc/cp/parser.c:11264
0x684cbf cp_parser_translation_unit
../../gcc/cp/parser.c:4100
0x684cbf c_parse_file()
../../gcc/cp/parser.c:33192
0x736ac2 c_common_parse_file()
../../gcc/c-family/c-opts.c:1057
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
2015-04-10 18:51 ` [Bug c++/65734] " hubicka at gcc dot gnu.org
@ 2015-04-10 19:39 ` jason at gcc dot gnu.org
2015-04-11 4:16 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-04-10 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-04-10
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
2015-04-10 18:51 ` [Bug c++/65734] " hubicka at gcc dot gnu.org
2015-04-10 19:39 ` jason at gcc dot gnu.org
@ 2015-04-11 4:16 ` jason at gcc dot gnu.org
2015-04-28 14:44 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-04-11 4:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 35297
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35297&action=edit
patch
A fix for after GCC 5 branches.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
` (2 preceding siblings ...)
2015-04-11 4:16 ` jason at gcc dot gnu.org
@ 2015-04-28 14:44 ` jason at gcc dot gnu.org
2015-04-28 15:23 ` jason at gcc dot gnu.org
2015-08-17 15:45 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-04-28 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Apr 28 14:43:48 2015
New Revision: 222529
URL: https://gcc.gnu.org/viewcvs?rev=222529&root=gcc&view=rev
Log:
PR c++/65734
gcc/
* stor-layout.c (layout_type): Layout the TYPE_MAIN_VARIANT.
(finalize_type_size): Respect TYPE_USER_ALIGN.
(layout_type) [ARRAY_TYPE]: Likewise.
gcc/cp/
* class.c (fixup_attribute_variants): Respect TYPE_USER_ALIGN.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/alignas1.C
trunk/gcc/testsuite/g++.dg/cpp0x/alignas2.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/stor-layout.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
` (3 preceding siblings ...)
2015-04-28 14:44 ` jason at gcc dot gnu.org
@ 2015-04-28 15:23 ` jason at gcc dot gnu.org
2015-08-17 15:45 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-04-28 15:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |6.0
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65734] Yet another case of lost alignment by stor_layout
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
` (4 preceding siblings ...)
2015-04-28 15:23 ` jason at gcc dot gnu.org
@ 2015-08-17 15:45 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-08-17 15:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65734
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Aug 17 15:44:35 2015
New Revision: 226941
URL: https://gcc.gnu.org/viewcvs?rev=226941&root=gcc&view=rev
Log:
PR c++/65734
gcc/
* stor-layout.c (layout_type): Layout the TYPE_MAIN_VARIANT.
(finalize_type_size): Respect TYPE_USER_ALIGN.
(layout_type) [ARRAY_TYPE]: Likewise.
gcc/cp/
* class.c (fixup_attribute_variants): Respect TYPE_USER_ALIGN.
Added:
branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/alignas1.C
branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/alignas2.C
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/cp/ChangeLog
branches/gcc-5-branch/gcc/cp/class.c
branches/gcc-5-branch/gcc/stor-layout.c
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-17 15:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 18:49 [Bug c++/65734] New: Yet another case of lost alignment by stor_layout hubicka at gcc dot gnu.org
2015-04-10 18:51 ` [Bug c++/65734] " hubicka at gcc dot gnu.org
2015-04-10 19:39 ` jason at gcc dot gnu.org
2015-04-11 4:16 ` jason at gcc dot gnu.org
2015-04-28 14:44 ` jason at gcc dot gnu.org
2015-04-28 15:23 ` jason at gcc dot gnu.org
2015-08-17 15:45 ` 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).