Subject: Re: bug#29183: 27.0.50; SIGSEGV on C-g on Windows

From: Paul Eggert <[email-masked]>
Date: Wed, 8 Nov 2017 14:46:53 -0800

On 11/08/2017 10:53 AM, Eli Zaretskii wrote:
> it sounds like our assumption that this attribute should be a no-op in 
> this case is incorrect, or maybe it's a bug in GCC 7.2? 

The GCC 7.2 documentation 
<https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Common-Variable-Attributes.html#index-aligned-variable-attribute> 
says:

> When used on a struct, or struct member, the |aligned| attribute can 
> only increase the alignment; in order to decrease it, the |packed| 
> attribute must be specified as well.

so it appears to be a bug.

What is the difference in assembly-language output when you compile with 
this:

   static struct thread_state GCALIGNED main_thread;

versus this?

   static struct thread_state main_thread;

What is the assembly-language output when compiling the following little program, when compiled the same way that you compile thread.c?

   struct thread_state { int x; };
   static struct thread_state __attribute__ ((aligned (8))) a;
   static struct thread_state b;
   struct thread_state *c[] = { &a, &b };

On my platform, compiling this with gcc -S yields the following, which looks properly aligned:

	.file	"t.c"
	.local	a
	.comm	a,4,8
	.local	b
	.comm	b,4,4
	.globl	c
	.data
	.align 16
	.type	c, @object
	.size	c, 16
c:
	.quad	a
	.quad	b
	.ident	"GCC: (GNU) 7.2.1 20170915 (Red Hat 7.2.1-2)"
	.section	.note.GNU-stack,"",@progbits