Re: gcc4, static array, SSE alignement

2005-04-06 Thread tbp
On Apr 6, 2005 3:18 AM, James E Wilson [EMAIL PROTECTED] wrote:
 I would guess a limitation of cygwin binutils support, or perhaps of
 Windows itself.
Binutils, perhaps. Windows certainly not as msvc2k3  icc8.1 don't
have such issue with the same code.

 This seems to work fine on linux.  If I compile a simple example using
 __alignof__, I see that the compiler is assuming 16-byte alignment.  If
 I compile with -S, I see that the compiler is giving them 32-byte
 alignment (probably for better cache alignment).  If I run objdump -x on
 the a.out file, I see that .bss section has 2**5 (32-byte) alignment.
 All is as it should be.
Sections:
Idx Name  Size  VMA   LMA   File off  Algn
  0 .text 0003e754  00401000  00401000  0400  2**4
  CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
  1 .data 4634  0044  0044  0003ec00  2**4
  CONTENTS, ALLOC, LOAD, DATA
  2 .rdata4884  00445000  00445000  00043400  2**4
  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .bss  8fc0  0044a000  0044a000    2**4
  ALLOC
  4 .idata1984  00453000  00453000  00047e00  2**2
  CONTENTS, ALLOC, LOAD, DATA
  5 .stab 00169908  00455000  00455000  00049800  2**2
  CONTENTS, READONLY, DEBUGGING, NEVER_LOAD, EXCLUDE
  6 .stabstr  001c39e1  005bf000  005bf000  001b3200  2**0
  CONTENTS, READONLY, DEBUGGING, NEVER_LOAD, EXCLUDE

Gcc  the toolchain used to have lots of issues wrt alignement, but i
thought they were a thing of the past.
As far as i can see, everything is fine regarding section alignements.

 A real bug report, as per
  http://gcc.gnu.org/bugs.html
 would be useful here, so we can check.  In particular, a testcase to
 reproduce the problem, and exactly what you believe is wrong with the
 output.
Yep, but i was testing the water.
I mean i have lots of other 16 bytes aligned data (static, extern,
const or not and whatnot) in there and the only problematic one is
this semi large static.
So, because that's the largest, i thought i've crossed some magic size
threshold.

I'll try to pinpoint the problem a bit better.


Re: gcc4, static array, SSE alignement

2005-04-06 Thread tbp
On Apr 6, 2005 2:08 PM, tbp [EMAIL PROTECTED] wrote:
 I'll try to pinpoint the problem a bit better.
Alas, since the other day the code using that static array has changed
a bit and i can't reproduce the bug.
So, after all, it really was gcc's fault.

I'll try to dig up the original version.


Re: gcc4, static array, SSE alignement

2005-04-05 Thread James E Wilson
tbp wrote:
Question: why do i get an unaligned array as soon as g++ (4.1.0
20050327, cygwin) finds out that it's static (i mean even if i try to
fool it around a bit)?
I would guess a limitation of cygwin binutils support, or perhaps of 
Windows itself.

This seems to work fine on linux.  If I compile a simple example using 
__alignof__, I see that the compiler is assuming 16-byte alignment.  If 
I compile with -S, I see that the compiler is giving them 32-byte 
alignment (probably for better cache alignment).  If I run objdump -x on 
the a.out file, I see that .bss section has 2**5 (32-byte) alignment. 
All is as it should be.

We can't give a section more alignment than that supported by the OS, so 
if Windows only gives the bss and/or data sections 8 byte alignment, 
then variables in these sections can never have more than 8 byte alignment.

A real bug report, as per
http://gcc.gnu.org/bugs.html
would be useful here, so we can check.  In particular, a testcase to 
reproduce the problem, and exactly what you believe is wrong with the 
output.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com