public inbox for
help / color / mirror / Atom feed
Subject: optimization/10774: Problem with ``-march=pentium4 -O''
Date: Wed, 14 May 2003 00:26:00 -0000	[thread overview]
Message-ID: <> (raw)

>Number:         10774
>Category:       optimization
>Synopsis:       Problem with ``-march=pentium4 -O''
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed May 14 00:26:00 UTC 2003
>Originator:     Mikhail Teterin
>Release:        gcc version 3.2.2
Reproduceable with:
	gcc version 3.2.2 [FreeBSD] 20030205 (release)
	gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
The attached file (you can remove the ``#include <stdio.h>'' line if you
insist) gets miscompiled with ``-march=pentium4 -O''. Removing the -O
or specifying another architecture (such as pentium3) fixes the problem.

The expected result is 0.5. But an optimized for pentium4 version
produces 5.29463e-315 (same value on both Linux and FreeBSD).
According to the debugger, the 22-nd line is skipped in the P4 case.

See also the FreeBSD problem reports:


% cc -O1 -march=pentium4 simple_pow.c -Wall && ./a.out
7.000000 ^ 2.100000
7.000000 ^ 2.100000
ax is 5.29463e-315
result is 5.29463e-315
% cc -O1 -march=pentium3 simple_pow.c -Wall && ./a.out
7.000000 ^ 2.100000
7.000000 ^ 2.100000
ax is 0.5
result is 0.5

Content-Type: text/x-csrc; name="simple_pow.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="simple_pow.c"


             reply	other threads:[~2003-05-14  0:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-14  0:26 mi+gcc [this message]
2003-05-14 18:06 Dara Hazeghi
2003-05-15  1:06 Mikhail Teterin
2003-05-15  3:06 Dara Hazeghi
2003-05-15 13:55 bangerth
2003-05-15 14:26 Mikhail Teterin

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:

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

  git send-email \ \ \ \ \

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