Bug 32969 - (rr)?spacing give wrong answers with -fdefault-integer-8
Summary: (rr)?spacing give wrong answers with -fdefault-integer-8
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: kargls
URL:
Keywords:
Depends on:
Blocks: default-integer-8
  Show dependency treegraph
 
Reported: 2007-08-02 16:22 UTC by Dominique d'Humieres
Modified: 2007-08-04 16:54 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-08-03 04:46:13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2007-08-02 16:22:53 UTC
With -fdefault-integer-8 the following code:

program test_rrspacing
  real x
  x = 3.0
  x = rrspacing(x)
  print *, x, spacing(x), spacing(3.0)
  x = 3.0
  x = spacing(x)
  print *, x
end

gives:

  0.7500000      1.6777216E+07  2.3841858E-07
  1.6777216E+07

instead of

  1.2582912E+07   1.000000      2.3841858E-07
  2.3841858E-07

Note that like PR32933 the code does not involve directly integers and as in the original test of PR32770 it seems to be linked to bigendian platforms (PPC here).
Comment 1 kargls 2007-08-03 04:46:13 UTC
I Know how to fix the problems with spacing and rrspacing.  Patch is 
forthcoming.
Comment 2 kargls 2007-08-04 16:49:03 UTC
Subject: Bug 32969

Author: kargl
Date: Sat Aug  4 16:48:50 2007
New Revision: 127205

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127205
Log:
2008-08-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/32968
	* gfortran.dg/selected_kind_1.f90: New test.

2008-08-04  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/32969
	* iresolve.c (gfc_resolve_rrspacing): Convert argument(s) to
	expected KIND.
	(gfc_resolve_scale): Ditto.
	(gfc_resolve_set_exponent): Ditto.
	(gfc_resolve_spacing): Ditto.
 
	PR fortran/32968
	* trans-intrinsic.c (gfc_conv_intrinsic_si_kind,
	gfc_conv_intrinsic_sr_kind): Convert the argument(s) to the
	expected KIND, and fold the result to the expected KIND.


Added:
    trunk/gcc/testsuite/gfortran.dg/selected_kind_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 kargls 2007-08-04 16:53:02 UTC
Should be fixed on trunk.  No back port.