From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18133 invoked by alias); 24 Jul 2009 12:04:00 -0000 Received: (qmail 15842 invoked by uid 48); 24 Jul 2009 12:03:45 -0000 Date: Fri, 24 Jul 2009 12:04:00 -0000 Subject: [Bug c/40845] New: malign-double witout effect for long double type X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bugtrack at roumenpetrov dot info" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg01975.txt.bz2 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 #include #include #include 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