public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64
@ 2003-09-06 23:17 gbeauchesne at mandrakesoft dot com
2003-09-07 0:52 ` [Bug optimization/12199] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gbeauchesne at mandrakesoft dot com @ 2003-09-06 23:17 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
Summary: [3.3-hammer regression] long double miscompilation in
gsl/amd64
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gbeauchesne at mandrakesoft dot com
CC: aj at suse dot de,gcc-bugs at gcc dot gnu dot org,jh at
suse dot cz
GCC host triplet: x86_64-unknown-linux-gnu
Hi,
The following testcase reduced from gsl is miscompiled only with 3.3-hammer branch as of today.
This is a regression from plain 3.3-branch. Sounds like conversion from double to long double
delta variable gets mad.
The bug is exhausted at -O2 and vanishes at -O1 or with extra -fno-regmove.
---
extern void abort (void);
static double
fabs (double x)
{
return x < 0 ? -x : x;
}
static void
check (double result, double expected, double relative_error)
{
int status = -1;
if (result < 0 || result > 0)
status = (fabs(result - expected)/fabs(expected) > relative_error);
if (status)
abort ();
}
int
main (void)
{
const int na = 14;
const double rawa[] =
{.0421, .0941, .1064, .0242, .1331,
.0773, .0243, .0815, .1186, .0356,
.0728, .0999, .0614, .0479};
double rel = 1e-10;
{
const double mean = 0.0728;
const double expected = 0.00113837428571429;
long double variance = 0 ;
int i;
for (i = 0; i < na; i++)
{
const long double delta = (rawa[i] - mean);
variance += (delta * delta - variance) / (i + 1);
}
check (variance, expected, rel);
}
return 0;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
@ 2003-09-07 0:52 ` pinskia at gcc dot gnu dot org
2003-09-07 7:52 ` gbeauchesne at mandrakesoft dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-07 0:52 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|x86_64-unknown-linux-gnu |
GCC target triplet| |x86_64-unknown-linux-gnu
Keywords| |wrong-code
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-07 00:52 -------
I think the reason why with -O2, it is exhausted, is because check and (I think fabs, might have
already) gets inlined because unit-at-a-time is enabled on the 3.3-hammer branch (and the
mainline also) at -O2 and above.
It would be nice to know if this bug is also on the mainline.
Also what happens if you add __attribute__((__no_inline__)) to the function check, does it still
create wrong code?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
2003-09-07 0:52 ` [Bug optimization/12199] " pinskia at gcc dot gnu dot org
@ 2003-09-07 7:52 ` gbeauchesne at mandrakesoft dot com
2003-09-09 13:53 ` gbeauchesne at mandrakesoft dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: gbeauchesne at mandrakesoft dot com @ 2003-09-07 7:52 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
------- Additional Comments From gbeauchesne at mandrakesoft dot com 2003-09-07 07:52 -------
Subject: Re: [3.3-hammer regression] long double miscompilation in gsl/amd64
Hi,
> I think the reason why with -O2, it is exhausted, is because check and
> (I think fabs, might have
> already) gets inlined because unit-at-a-time is enabled on the
> 3.3-hammer branch (and the
> mainline also) at -O2 and above.
Actually it is also exhausted with a 3.3-hammer branch snapshot as far
as 2003/05/27, i.e. without -funit-at-a-time support by default at -O2.
I strongly believe fabs() & check() are not the culprit since in the
original GSL test, they were part of other files I haven't rebuilt when
reducing the testcase.
> It would be nice to know if this bug is also on the mainline.
It doesn't occur on mainline of yesterday.
> Also what happens if you add __attribute__((__no_inline__)) to the
> function check, does it still
> create wrong code?
It does.
Bye,
Gwenole.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
2003-09-07 0:52 ` [Bug optimization/12199] " pinskia at gcc dot gnu dot org
2003-09-07 7:52 ` gbeauchesne at mandrakesoft dot com
@ 2003-09-09 13:53 ` gbeauchesne at mandrakesoft dot com
2003-09-09 15:01 ` jh at suse dot cz
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: gbeauchesne at mandrakesoft dot com @ 2003-09-09 13:53 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
------- Additional Comments From gbeauchesne at mandrakesoft dot com 2003-09-09 13:53 -------
Subject: Re: [3.3-hammer regression] long double
miscompilation in gsl/amd64
The testcase also fails on ia32 with SSE support that way:
gcc -m32 fp.c -O2 -mfpmath=sse -march=k8 (or -march=pentium4)
Actually, the following patch fixes it:
<http://gcc.gnu.org/ml/gcc-patches/2003-06/msg03278.html>
Jan, can you please commit the fix to 3.3-hammer along with the testcase?
Thanks,
Gwenole.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
` (2 preceding siblings ...)
2003-09-09 13:53 ` gbeauchesne at mandrakesoft dot com
@ 2003-09-09 15:01 ` jh at suse dot cz
2003-10-01 15:06 ` zlomek at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jh at suse dot cz @ 2003-09-09 15:01 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
------- Additional Comments From jh at suse dot cz 2003-09-09 15:01 -------
Subject: Re: [3.3-hammer regression] long double miscompilation in gsl/amd64
> The testcase also fails on ia32 with SSE support that way:
> gcc -m32 fp.c -O2 -mfpmath=sse -march=k8 (or -march=pentium4)
>
> Actually, the following patch fixes it:
> <http://gcc.gnu.org/ml/gcc-patches/2003-06/msg03278.html>
>
> Jan, can you please commit the fix to 3.3-hammer along with the testcase?
Sure, working on that.
Honza
>
> Thanks,
> Gwenole.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
` (3 preceding siblings ...)
2003-09-09 15:01 ` jh at suse dot cz
@ 2003-10-01 15:06 ` zlomek at gcc dot gnu dot org
2003-12-09 18:23 ` dhazeghi at yahoo dot com
2004-04-21 2:16 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: zlomek at gcc dot gnu dot org @ 2003-10-01 15:06 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
zlomek at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From zlomek at gcc dot gnu dot org 2003-10-01 15:06 -------
Honza forgot to close bug report after comminting the fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
` (4 preceding siblings ...)
2003-10-01 15:06 ` zlomek at gcc dot gnu dot org
@ 2003-12-09 18:23 ` dhazeghi at yahoo dot com
2004-04-21 2:16 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-09 18:23 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12199] [3.3-hammer regression] long double miscompilation in gsl/amd64
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
` (5 preceding siblings ...)
2003-12-09 18:23 ` dhazeghi at yahoo dot com
@ 2004-04-21 2:16 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-21 2:16 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12199
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-04-21 1:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-06 23:17 [Bug optimization/12199] New: [3.3-hammer regression] long double miscompilation in gsl/amd64 gbeauchesne at mandrakesoft dot com
2003-09-07 0:52 ` [Bug optimization/12199] " pinskia at gcc dot gnu dot org
2003-09-07 7:52 ` gbeauchesne at mandrakesoft dot com
2003-09-09 13:53 ` gbeauchesne at mandrakesoft dot com
2003-09-09 15:01 ` jh at suse dot cz
2003-10-01 15:06 ` zlomek at gcc dot gnu dot org
2003-12-09 18:23 ` dhazeghi at yahoo dot com
2004-04-21 2:16 ` pinskia at gcc dot gnu dot org
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).