public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/54120] [4.8 Regression] FAIL: gfortran.fortran-torture/execute/random_2.f90 execution
Date: Mon, 07 Jan 2013 16:34:00 -0000	[thread overview]
Message-ID: <bug-54120-4-DTbHXyCeYl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54120-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54120

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-07 16:34:14 UTC ---
Ah, ok, seems indeed to be HWI size related and also (due to an earlier bug)
related to the revision you've mentioned.
So, with an i686-linux -> hppa2.0w-hp-hpux11.11 cross this is reproduceable
with -O2 on:
extern unsigned int *kiss_seed_1;
extern unsigned int *kiss_seed_2;
unsigned int kiss_random_kernel(unsigned int * seed);

void
foo (double *x)
{
  unsigned long long mask, kiss = ((unsigned long long) kiss_random_kernel
(kiss_seed_1)) << 32;
  kiss += kiss_random_kernel (kiss_seed_2);
  mask = ~ (unsigned long long) 0u << (64 - 53);
  kiss = kiss & mask;
  *x = (double) kiss * (0x1.p-64);
}

and the problem is that starting with r189366 VRP incorrectly does:
   kiss_9 = kiss_8 & 0xfffffffffffff800;
-  D.1358_10 = (double) kiss_9;
+  D.1363_17 = (signed int) kiss_9;
+  D.1358_10 = (double) D.1363_17;

The bugs seem to be in simplify_float_conversion_using_ranges and
range_fits_type_p.  The simplify_float_conversion_using_ranges bug (now just
code consistency issue, before r189366 a real bug) is that the second
can_float_p is tested for != 0 (implicitly) instead of != CODE_FOR_nothing.
Starting with r189366 it doesn't make a real difference, before that
CODE_FOR_nothing was some big number and this fact hid the other bug.

>From the kiss_9 assignment, VRP determines vr to be
[0, 0xfffffffffffff800]
(in unsigned long long type).

And now the bug is that while range_fits_type_p (vr, 8, 0) and
range_fits_type_p (vr, 64, 0) correctly return false, such big 64-bit range
really doesn't fit into signed 8-bit or signed 64-bit range,
range_fits_type_p (vr, 16, 0) and range_fits_type_p (vr, 32, 0) incorrectly
return true - and for floatsidf2 there is a pattern, which is why we miscompile
it.


  parent reply	other threads:[~2013-01-07 16:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 17:46 [Bug fortran/54120] New: " danglin at gcc dot gnu.org
2012-07-30 20:55 ` [Bug fortran/54120] " danglin at gcc dot gnu.org
2012-07-31 14:50 ` [Bug middle-end/54120] " burnus at gcc dot gnu.org
2012-09-19 14:08 ` rguenth at gcc dot gnu.org
2012-12-19 10:55 ` jakub at gcc dot gnu.org
2012-12-19 12:58 ` dave.anglin at bell dot net
2012-12-22 23:01 ` danglin at gcc dot gnu.org
2012-12-22 23:02 ` danglin at gcc dot gnu.org
2012-12-22 23:07 ` jakub at gcc dot gnu.org
2012-12-22 23:35 ` danglin at gcc dot gnu.org
2012-12-22 23:38 ` danglin at gcc dot gnu.org
2013-01-07 14:51 ` jakub at gcc dot gnu.org
2013-01-07 16:34 ` jakub at gcc dot gnu.org [this message]
2013-01-07 17:28 ` jakub at gcc dot gnu.org
2013-01-07 18:09 ` dave.anglin at bell dot net
2013-01-08  8:34 ` jakub at gcc dot gnu.org
2013-01-08  9:09 ` jakub at gcc dot gnu.org

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=bug-54120-4-DTbHXyCeYl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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