Bug 8947 - Please add a Warning about "-malign-double" in docs
Summary: Please add a Warning about "-malign-double" in docs
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: ---
Assignee: Janis Johnson
URL:
Keywords:
: 8951 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-15 02:16 UTC by norbert_wolff
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description norbert_wolff 2002-12-15 02:16:01 UTC
    Please add a note in your docs that is not possible to compile
    the GNU-libc (i tried it with 2.3.1) with the options
    "-malign-double" and/or "-m128bit-long-double".

    The increased aligment of long doubles caused by this switches
    crashes the calculations in glibc-2.3.1/io/fts.c,
    so every call of one of the stat-functions will fail...

    Thanks,
     Norbert Wolff

Release:
3.3 20021214 (experimental)

Environment:
System: Linux icarus 2.4.19 #1 i686
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --with-gnu-ld --with-gnu-as --disable-nls
  -prefix=/opt/gcc3.3 i686-linux
Comment 1 Wolfgang Bangerth 2002-12-21 09:40:22 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: Can you give any indications as to what exactly goes wrong?
    It is not very helpful just to document that some option
    might not work in some circumstances. I think it would be
    much better if we actually _fixed_ the problem that was
    causing the problem.
    
    Thanks
      Wolfgang
Comment 2 janis187 2003-01-03 15:55:05 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org, norbert_wolff@t-online.de
Cc:  
Subject: Re: other/8947: Please add a Warning about "-malign-double" in docs
Date: Fri, 03 Jan 2003 15:55:05 -0800

 The mainline version of install.texi includes the following
 after the description of -malign-double:
 
   @strong{Warning:} if you use the @samp{-malign-double}
   switch, structures containing the above types will be
   aligned differently than the published application binary
   interface specifications for the 386.
 
 If that's not strong enough, we could also add:
 
   Code compiled with @option{-malign-double} is not binary
   compatible with code compiled without that switch.
 
 Similar language is now used for warnings about several
 other options.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8947
 
 
 

Comment 3 Wolfgang Bangerth 2003-01-03 17:23:17 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Norbert Wolff <norbert_wolff@t-online.de>
Cc: glibc-bug-reports-2.3.1@gnu.org, <gcc-bugs@gcc.gnu.org>,
   <gcc-gnats@gcc.gnu.org>
Subject: Re: other/8947: Please add a Warning about "-malign-double" in docs
Date: Fri, 3 Jan 2003 17:23:17 -0600 (CST)

 Norbert,
 I fear I don't understand much of the issue, but do I understand it 
 correctly that glibc is using assumptions about gcc's behavior that are 
 only valid of -malign-double is _not_ used?
 
 Thinking more about your request, I believe that it is more appropriate to 
 document this in the glibc pages (or fix the behavior in glibc), since we 
 can impossibly list requirements like this on the gcc page (for which out 
 of the zillion projcets out there should we document them?).
 
 If you agree with this, I'd like to close the gcc report and ask you to 
 file a report against glibc about this.
 
 Thanks
   Wolfgang
 
 
 
 On Sun, 29 Dec 2002, Norbert Wolff wrote:
 
 > Subject:        stat-calls fail with certain gcc-switches
 > >Submitter-Id:  net
 > >Confidential:  no
 > >Synopsis:      Problems with stat-calls and "-malign-double"
 > >Severity:      critical
 > >Priority:      high
 > >Category:      libc
 > >Class:         sw-bug
 > >Release:       libc-2.3.1
 > >Environment:
 > 	System: linux-2.4.19
 > 	Arch:   i686
 > >Description:   please see below
 > 
 > >   Please add a note in your docs that is not possible to compile
 > >    the GNU-libc (i tried it with 2.3.1) with the options
 > >    "-malign-double" and/or "-m128bit-long-double".
 > >
 > >    The increased aligment of long doubles caused by this switches
 > >    crashes the calculations in glibc-2.3.1/io/fts.c,
 > >    so every call of one of the stat-functions will fail...
 > 
 > 
 >  On 21 Dec 2002 17:40:22 -0000
 >  bangerth@dealii.org wrote:
 > 
 > >     Can you give any indications as to what exactly goes wrong?
 > >     It is not very helpful just to document that some option
 > >     might not work in some circumstances. I think it would be
 > >     much better if we actually _fixed_ the problem that was
 > >     causing the problem.
 > 
 >  Hi Wolfgang,
 > 
 >  In the glibc-sources the alignment of long doubles is used
 >  to calculate the fts_statp component of the FTSENT
 > 
 >    ---------------------------- file: io/fts.c
 > 
 >    /* Largest alignment size needed, minus one.
 >      Usually long double is the worst case.  */
 >    #ifndef ALIGNBYTES
 >    #define ALIGNBYTES	(__alignof__ (long double) - 1)
 >    #endif
 >    /* Align P to that size.  */
 >    #ifndef ALIGN
 >    #define	ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
 >    #endif
 > 
 >    ...
 > 
 >    static FTSENT *
 >    internal_function
 >    fts_alloc(sp, name, namelen)
 >  	FTS *sp;
 >  	const char *name;
 > 	register int namelen;
 >    {
 >  	register FTSENT *p;
 > 	size_t len;
 > 
 > 	len = sizeof(FTSENT) + namelen;
 > 	if (!ISSET(FTS_NOSTAT))
 > 		len += sizeof(struct stat) + ALIGNBYTES;
 > 	if ((p = malloc(len)) == NULL)
 > 		return (NULL);
 > 
 > 	memmove(p->fts_name, name, namelen);
 > 	p->fts_name[namelen] = '\0';
 > 
 > 	if (!ISSET(FTS_NOSTAT))
 > 		p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
 > 
 >     ----------------------------
 > 
 >  I dont understand what long doubles have to do with stat-calls,
 >  but when you increase the alignment of them to 16 instead of 4, which is
 >  one consequence of the gcc-switches 
 >    "-malign-double" and/or "-m128bit-long-double"
 >  every stat-call will fail with errno set to EOVERFLOW.
 > 
 >  I agree with you that it would be better to _fix_ the problem, than
 >  adding a note in the docs, but that is a job for the glibc-people,
 >  as gcc creates correct code.
 >  
 >  I have send a copy of this mail to the glibc-buglist and hope for the
 >  best...
 > 
 >  Thanks,
 >    Norbert
 > 
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 

Comment 4 Daniel Jacobowitz 2003-01-03 21:27:13 UTC
From: Daniel Jacobowitz <drow@mvista.com>
To: Janis Johnson <janis187@us.ibm.com>
Cc: gcc-gnats@gcc.gnu.org, norbert_wolff@t-online.de
Subject: Re: other/8947: Please add a Warning about "-malign-double" in docs
Date: Fri, 3 Jan 2003 21:27:13 -0500

 On Fri, Jan 03, 2003 at 03:55:05PM -0800, Janis Johnson wrote:
 > The mainline version of install.texi includes the following
 > after the description of -malign-double:
 > 
 >   @strong{Warning:} if you use the @samp{-malign-double}
 >   switch, structures containing the above types will be
 >   aligned differently than the published application binary
 >   interface specifications for the 386.
 > 
 > If that's not strong enough, we could also add:
 > 
 >   Code compiled with @option{-malign-double} is not binary
 >   compatible with code compiled without that switch.
 > 
 > Similar language is now used for warnings about several
 > other options.
 
 I think that your proposed addition is exactly what we should say about
 this; it's much clearer to the layperson.
 
 -- 
 Daniel Jacobowitz
 MontaVista Software                         Debian GNU/Linux Developer

Comment 5 Janis Johnson 2003-01-07 17:25:05 UTC
Responsible-Changed-From-To: unassigned->janis
Responsible-Changed-Why: mine
Comment 6 Janis Johnson 2003-01-07 17:25:05 UTC
State-Changed-From-To: feedback->closed
State-Changed-Why: fixed in mainline (3.4), 3.3 branch, and 3.2 branch
Comment 7 Janis Johnson 2003-01-08 01:12:30 UTC
From: janis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/8947
Date: 8 Jan 2003 01:12:30 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	janis@gcc.gnu.org	2003-01-07 17:12:30
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/doc        : invoke.texi 
 
 Log message:
 	2003-01-07  Janis Johnson  <janis187@us.ibm.com>
 	
 	PR other/8947
 	* doc/invoke.texi (-malign-double): Explain that the option breaks
 	binary compatibility.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.16284&r2=1.16285
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.218&r2=1.219
 

Comment 8 Janis Johnson 2003-01-08 01:13:47 UTC
From: janis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/8947
Date: 8 Jan 2003 01:13:47 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	janis@gcc.gnu.org	2003-01-07 17:13:46
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/doc        : invoke.texi 
 
 Log message:
 	2003-01-07  Janis Johnson  <janis187@us.ibm.com>
 	
 	PR other/8947
 	* doc/invoke.texi (-malign-double): Explain that the option breaks
 	binary compatibility.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.43&r2=1.16114.2.44
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.209.2.6&r2=1.209.2.7
 
Comment 9 Janis Johnson 2003-01-08 01:17:12 UTC
From: janis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/8947
Date: 8 Jan 2003 01:17:12 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	janis@gcc.gnu.org	2003-01-07 17:17:12
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/doc        : invoke.texi 
 
 Log message:
 	2003-01-07  Janis Johnson  <janis187@us.ibm.com>
 	
 	PR other/8947
 	* doc/invoke.texi (-malign-double): Explain that the option breaks
 	binary compatibility.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.171&r2=1.13152.2.657.2.172
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.119.2.12.4.9&r2=1.119.2.12.4.10