alignment of double ("g++ bug in Ubuntu Lucid Lynx")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try -mno-align-double.

jay@xlin2:~$ gcc -malign-double 1.c
jay@xlin2:~$ ./a.out
0x8

jay@xlin2:~$ gcc -mno-align-double 1.c
jay@xlin2:~$ ./a.out
0x4

jay@xlin2:~$ gcc  1.c
jay@xlin2:~$ ./a.out
0x4

jay@xlin2:~$ cat 1.c
struct
{
  int a;
  double b;
} *c = 0;
#include <stdio.h>

int main()
{
  printf("%p\n", &c->b);
  return 0;
}

Rhetorical question: How are you reading your files on PowerPC, MIPS, Alpha, SPARC... ?
I assume you aren't.

(I'm not using Ubuntu.)

 - Jay

--Forwarded Message Attachment--
Date: Wed, 2 Jun 2010 11:53:29 -0400
From: ddoucette@xxxxxxxxxxxxxxxx
To: gcc-help@xxxxxxx
Subject: g++ serious bug in Ubuntu Lucid Lynx


We just installed Lucid Lynx a few days ago, and have hit a fatal flaw
with g++ that has forced us to stop the deployment and roll back the
systems we could.

Structures in Lucid are now mapping differently than in the past, so we
can no longer read our own files! Further, if any files are written by
code produced by the new g++, they are corrupted.

The problem is that doubles are now being mapped onto a boundary
divisible by 8 rather than a boundary divisible by 4, meaning that
offsets change and structs get bigger.

I've attached a tar file showing the mapping on Jaunty, Karmic, and
Lucid to show the change. This is a greatly simplified program that
shows the problem, but it's happening in all of our C++ programs.

HELP!

System is Ubuntu 10.4 Lucid Lynx 64 bit.

David Doucette
 		 	   		  



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux