This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Double alignment trouble
- To: "'cygwin@sourceware.cygnus.com'" <cygwin@sourceware.cygnus.com>
- Subject: Double alignment trouble
- From: OSKAR BERRETEAGA <oskarb@fagorautomation.es>
- Date: Mon, 8 Feb 1999 10:21:25 +0100
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
Hi, all,
I've been trying to change the way gcc aligns double type variables but
with no possitive result. This is the test file I've used:
-------------------------------------> Source file begins
struct mystr_st
{
char onebyte;
double onedouble;
};
typedef struct mystr_st MYSTR;
MYSTR myvar;
void foo(void)
{
myvar.onebyte = 1;
myvar.onedouble = 0.0;
}
-------------------------------------> End of source file
These are the options I've set with gcc: -malign-double (alone or with
one of the following -march='pentium' -m386 -m486) and the full command
line is: gcc -c test.c -malign-double -o test.o
I've even used the __attribute__((aligned(2))) for both the struct and
the double var but, again, it seems it has no effect on double
alignment.
>
>Everytime I get the following assembler listing file without regard to
>the options I set:
>
>---------------------------------------------> Listing file begins
>
>GAS LISTING C:\WINDOWS\TEMP\ccWk6MAE.s page 1
>
>
> 1 .file "test.c"
> 2 gcc2_compiled.:
> 3 ___gnu_compiled_c:
> 4 .text
> 5 .align 4
> 6 .globl _foo
> 7 .def _foo; .scl 2; .type 32; .endef
> 8 _foo:
> 9 0000 55 pushl %ebp
> 10 0001 89E5 movl %esp,%ebp
> 11 0003 C6050000 movb $1,_myvar
> 11 000001
> 12 000a C7050800 movl $0,_myvar+8
> 12 00000000
> 12 0000
> 13 0014 C7050C00 movl $0,_myvar+12
> 13 00000000
> 13 0000
> 14 L1:
> 15 001e 89EC movl %ebp,%esp
> 16 0020 5D popl %ebp
> 17 0021 C3 ret
> 18 .comm _myvar, 16 # 16
>
>------------------------------------------> End of listing file
>
>I somehow expected to see a '+4' in line 12 when moving to the double
>var. Is there anyway to change it or am I missing something?
>Thanks in advance.
>
>Oskar Berreteaga Castro
>Depto. I+D Software
>e-mail: oskarb@fagorautomation.es
>
>----------------------------------------------------
>Fagor Automation, S.Coop.
>Barrio San Andres, s/n - P.O. Box. 144
>Mondragon 20500 - SPAIN
>
>Tfno: +34-943 79 95 11
>Fax: +34-943 79 17 12
>http://www.fagorautomation.mcc.es
>----------------------------------------------------
>
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com