public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/9641: const double arguments and -ffloat-store do not work together
@ 2003-02-10 22:55 ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: ehrhardt @ 2003-02-10 22:55 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, richard

Synopsis: const double arguments and -ffloat-store do not work together

State-Changed-From-To: open->feedback
State-Changed-By: cae
State-Changed-When: Mon Feb 10 22:55:49 2003
State-Changed-Why:
    Can't reproduce this with 3.2 or 3.4. Could you try with a more
    recent version of gcc?

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9641


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: optimization/9641: const double arguments and -ffloat-store do not work together
@ 2003-02-11  9:43 ehrhardt
  0 siblings, 0 replies; 4+ messages in thread
From: ehrhardt @ 2003-02-11  9:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, richard

Synopsis: const double arguments and -ffloat-store do not work together

State-Changed-From-To: feedback->closed
State-Changed-By: cae
State-Changed-When: Tue Feb 11 09:43:08 2003
State-Changed-Why:
    2.96 is not an official GNU release. Besides gcc versions before
    3.2 are no longer supported. If you actually can reproduce this
    with a compiler that is still supported please feel free to file
    a new report or tell me and I'll reopen this one.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9641


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: optimization/9641: const double arguments and -ffloat-store do not  work together
@ 2003-02-10 23:26 Richard Addison-Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Addison-Wood @ 2003-02-10 23:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/9641; it has been noted by GNATS.

From: Richard Addison-Wood <richard@wetafx.co.nz>
To: richard@wetafx.co.nz, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: optimization/9641: const double arguments and -ffloat-store do not 
 work together
Date: Tue, 11 Feb 2003 12:17:04 +1300

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9641
 
 3.2 or 3.4 is irrelevant for the time being.  I'm writing
 DSOs that are loaded by an application that is compiled
 with 2.96.  I have no control over how that application
 is compiled.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* optimization/9641: const double arguments and -ffloat-store do not work together
@ 2003-02-10  7:56 richard
  0 siblings, 0 replies; 4+ messages in thread
From: richard @ 2003-02-10  7:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9641
>Category:       optimization
>Synopsis:       const double arguments and -ffloat-store do not work together
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 10 07:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     richard@wetafx.co.nz
>Release:        gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)
>Organization:
>Environment:
Linux 2.4.18-xfssmp #1 SMP i686
>Description:
//////////main.c
double rightfunc(double);
double wrongfunc(double);
int
main(void)
{
  rightfunc(0.75);
  wrongfunc(0.25);
}
//////////funcs.c
double rightfunc(double t) { return t; }
double wrongfunc(const double t) { return t; }
//////////GNUmakefile
all:    wrong right
right:  main.c funcs.c; gcc -O3 -o $@ main.c funcs.c
wrong:  main.c funcs.c; gcc -O3 -ffloat-store -o $@ main.c funcs.c
>How-To-Repeat:
With the three supplied files, use gmake to build.

The generated 'right' file works properly, but the
generated 'wrong' file generates incorrect code for
the 'wrongfunc' function:

0x8048474 <wrongfunc>:  push   %ebp
0x8048475 <wrongfunc+1>:        mov    %esp,%ebp
0x8048477 <wrongfunc+3>:        sub    $0x8,%esp
0x804847a <wrongfunc+6>:        fldl   0xfffffff8(%ebp)
0x804847d <wrongfunc+9>:        leave  
0x804847e <wrongfunc+10>:       ret    
0x804847f <wrongfunc+11>:       nop    

Basically, the code uses memory that has not be set
to the value passed as a 'const double' argument.

Note that rightfunc() has a double argument, while
wrongfunc() has a const double argument.  Otherwise
they are the same.

The 'wrong' file is built with -ffloat-store while
the 'right' file is built without.
>Fix:
I can avoid 'const double' arguments, but this may
mean some sifting through large code bases.

I can avoid using -ffloat-store, but then I run into
other code generation issues because of the broken
nature how the optimizer handles comparisons with
floats and doubles on Intel.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-11  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-10 22:55 optimization/9641: const double arguments and -ffloat-store do not work together ehrhardt
  -- strict thread matches above, loose matches on Subject: below --
2003-02-11  9:43 ehrhardt
2003-02-10 23:26 Richard Addison-Wood
2003-02-10  7:56 richard

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).