public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bugtrack at roumenpetrov dot info" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/40845]  New: malign-double witout effect for long double type
Date: Fri, 24 Jul 2009 12:04:00 -0000	[thread overview]
Message-ID: <bug-40845-17984@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-07-24 12:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 12:04 bugtrack at roumenpetrov dot info [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40845-17984@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).