Bug 54167 - excessive alignment
Summary: excessive alignment
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-03 15:03 UTC by Ulrich Drepper
Modified: 2012-08-03 15:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Drepper 2012-08-03 15:03:04 UTC
Compile the following code:

struct c
{
  int a, b;
  /*constexpr*/ c() : a(1), b(2) { }
};

c v;


The variable v will be defined with:

	.bss
	.align 16
	.type	v, @object
	.size	v, 8
v:
	.zero	8

The variable has alignment 16!

If you uncomment the constexpr and compile with -std=gnu++11 it can be seen that the compiler does know what the correct alignment is:

	.globl	v
	.data
	.align 4
	.type	v, @object
	.size	v, 8
v:
	.long	1
	.long	2


This happens with the current svn version as well as with 4.7.0.