public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40845] New: malign-double witout effect for long double type
@ 2009-07-24 12:04 bugtrack at roumenpetrov dot info
2009-07-24 12:40 ` [Bug c/40845] " bugtrack at roumenpetrov dot info
2009-07-24 15:44 ` [Bug c/40845] malign-double without " rguenth at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: bugtrack at roumenpetrov dot info @ 2009-07-24 12:04 UTC (permalink / raw)
To: gcc-bugs
According to documentation (quote):
-----
-malign-double
-mno-align-double
Control whether GCC aligns double, long double, and long long variables on
a two word boundary or a one word boundary. Aligning double variables on a two
word boundary will produce code that runs somewhat faster on a `Pentium' at the
expense of more memory.
-----
Note for cygwin/mingw targets this options is enabled by default but it seems
to me do not work on long double type. The following code:
======================
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
typedef struct {
char a;
char x;
double b;
} offset_d;
typedef struct {
char a;
char x;
long double b
#if (defined(__MINGW32__) || defined(__CYGWIN__)) && 0
__attribute__((aligned(8)))
#endif
;
} offset_ld;
typedef struct {
char a;
char x;
long b;
} offset_l;
typedef long long longlong;
typedef struct {
char a;
char x;
longlong b;
} offset_ll;
#define OFFSET(a,b) ((char*)(a)-(char*)(b))
int main()
{
offset_d o_d ;
offset_ld o_ld;
offset_l o_l ;
offset_ll o_ll;
printf("sizeof/offset:");
printf(" o_d=%02d/%02d" , sizeof(o_d ), OFFSET(&o_d .b, &o_d .a));
printf(" o_ld=%02d/%02d", sizeof(o_ld), OFFSET(&o_ld.b, &o_ld.a));
printf(" o_l=%02d/%02d" , sizeof(o_l ), OFFSET(&o_l .b, &o_l .a));
printf(" o_ll=%02d/%02d", sizeof(o_ll), OFFSET(&o_ll.b, &o_ll.a));
printf("\n");
exit(0);
return(0);
}
======================
output following (see table):
version+flag o_d o_ld o_l o_ll
gcc4.2.4(linux ): 12/04 16/04 08/04 12/04
gcc4.2.4(linux+malign_double ): 16/08 16/04 08/04 16/08
gcc3.4.5(mingw32 ): 16/08 16/04 08/04 16/08
gcc4.4.0(mingw32 ): 16/08 16/04 08/04 16/08
gcc3.4.5(mingw32+-mno-align-double): 12/04 16/04 08/04 12/04
gcc4.4.0(mingw32+-mno-align-double): 12/04 16/04 08/04 12/04
Issue impacts:
- http://mail.python.org/ pipermail/python-dev/ 2009-July/090724.html
--
Summary: malign-double witout effect for long double type
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bugtrack at roumenpetrov dot info
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40845
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-24 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-24 12:04 [Bug c/40845] New: malign-double witout effect for long double type bugtrack at roumenpetrov dot info
2009-07-24 12:40 ` [Bug c/40845] " bugtrack at roumenpetrov dot info
2009-07-24 15:44 ` [Bug c/40845] malign-double without " rguenth at gcc dot gnu dot 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).