Bug 23912 - MOD function requires same kind arguments
Summary: MOD function requires same kind arguments
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Francois-Xavier Coudert
URL: http://gcc.gnu.org/ml/fortran/2005-11/
Keywords: patch, rejects-valid
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-09-16 08:56 UTC by Francois-Xavier Coudert
Modified: 2005-12-02 15:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-23 22:51:17


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-09-16 08:56:57 UTC
$ cat a.f 
      integer*8 i
      integer*4 j
      i = mod(i,j)
      end
$ g77 a.f   
$ ifort a.f 
$ pgf77 a.f 
$ gfortran a.f
 In file a.f:3

      i = mod(i,j)                                                      
               1
Error: 'p' argument of 'mod' intrinsic at (1) must be the same type and kind as 'a'


We should be able to have j folded to the same kind as i.
Comment 1 Andrew Pinski 2005-09-17 02:05:23 UTC
Confirmed.
Comment 2 Francois-Xavier Coudert 2005-11-23 22:51:17 UTC
Patch submitted for that bug. Waiting for approval.
Comment 3 Francois-Xavier Coudert 2005-11-27 14:01:42 UTC
Subject: Bug 23912

Author: fxcoudert
Date: Sun Nov 27 14:01:36 2005
New Revision: 107566

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107566
Log:
	PR fortran/23912

	* iresolve.c (gfc_resolve_dim, gfc_resolve_mod,
	gfc_resolve_modulo): When arguments have different kinds, fold
	the lower one to the largest kind.
	* check.c (gfc_check_a_p): Arguments of different kinds is not
	a hard error, but an extension.
	* simplify.c (gfc_simplify_dim, gfc_simplify_mod,
	gfc_simplify_modulo): When arguments have different kinds, fold
        the lower one to the largest kind.

	* gfortran.dg/modulo_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/modulo_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Francois-Xavier Coudert 2005-12-02 15:50:34 UTC
Subject: Bug 23912

Author: fxcoudert
Date: Fri Dec  2 15:50:30 2005
New Revision: 107897

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107897
Log:
	PR fortran/23912
	* iresolve.c (gfc_resolve_dim, gfc_resolve_mod,
	gfc_resolve_modulo): When arguments have different kinds, fold
	the lower one to the largest kind.
	* check.c (gfc_check_a_p): Arguments of different kinds is not
	a hard error, but an extension.
	* simplify.c (gfc_simplify_dim, gfc_simplify_mod,
	gfc_simplify_modulo): When arguments have different kinds, fold
	the lower one to the largest kind.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/check.c
    branches/gcc-4_1-branch/gcc/fortran/iresolve.c
    branches/gcc-4_1-branch/gcc/fortran/simplify.c

Comment 5 Francois-Xavier Coudert 2005-12-02 15:55:54 UTC
Fixed on 4.1 and mainline.