User account creation filtered due to spam.

Bug 20786 - Can't use AINT intrinsic with KIND parameter
Summary: Can't use AINT intrinsic with KIND parameter
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 4.0.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-04-06 09:54 UTC by Francois-Xavier Coudert
Modified: 2005-10-12 00:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-18 05:59:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-04-06 09:54:42 UTC
The following code is valid:

$ cat aint_mismatch.f 
      implicit none
      real(4) r
      r = aint (r,kind=8)
      end
$ gfortran aint_mismatch.f
aint_mismatch.f: In function ‘MAIN__’:
aint_mismatch.f:3: internal compiler error: in emit_move_insn, at expr.c:3085

The ICE disappears if kind=4 or if r is a real(8). This should be easy to fix,
since other similar intrinsics (such as ANINT) doesn't exhibit such ICE.
Comment 1 Andrew Pinski 2005-04-06 15:11:52 UTC
Confirmed, the problem is most likely we are missing a fold_convert somewhere converting from 
double down to float (sorry for using C types but it makes it easier sometimes).
Comment 2 Janne Blomqvist 2005-05-23 18:22:25 UTC
The ICE seems to have disappeared, but it still doesn't work correctly. E.g. 

      implicit none
      real(4) :: r = 42.0
      r = aint (r,kind=8)
      print *, r
      end

Prints out 0.000000
Comment 3 Janne Blomqvist 2005-06-11 20:07:42 UTC
Actually, ANINT also exhibits the same problem:

      implicit none
      real(4) :: r = 42.7, r2
      r2 = aint (r,kind=8)
      print *, 'aint: ', r2
      r2 = anint (r, kind=8)
      print *, 'anint: ', r2
      end

Prints out:

 aint:    0.000000
 anint:    0.000000
Comment 4 CVS Commits 2005-10-11 23:58:21 UTC
Subject: Bug 20786

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kargl@gcc.gnu.org	2005-10-11 23:58:17

Modified files:
	gcc/fortran    : ChangeLog iresolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: aint_anint_1.f90 

Log message:
	PR fortran/20786
	* iresolve.c (gfc_resolve_aint, gfc_resolve_anint ): Type conversion
	of the argument.
	
	gfortran.dg/aint_anint_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.578&r2=1.579
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/iresolve.c.diff?cvsroot=gcc&r1=1.41&r2=1.42
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6171&r2=1.6172
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/aint_anint_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 CVS Commits 2005-10-12 00:31:40 UTC
Subject: Bug 20786

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	kargl@gcc.gnu.org	2005-10-12 00:31:35

Modified files:
	gcc/fortran    : ChangeLog iresolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: aint_anint_1.f90 

Log message:
	PR fortran/20786
	*iresolve.c (gfc_resolve_aint, gfc_resolve_anint ): Type conversion
	of the argument.
	
	gfortran.dg/aint_anint_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.126&r2=1.335.2.127
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/iresolve.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32.2.4&r2=1.32.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.446&r2=1.5084.2.447
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/aint_anint_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 6 kargl 2005-10-12 00:32:58 UTC
Fixed.