OSDN Git Service

fortran/
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Feb 2014 12:41:53 +0000 (12:41 +0000)
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Feb 2014 12:41:53 +0000 (12:41 +0000)
        PR fortran/59599
        * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Calculate the
        number of arguments.

testsuite/
        PR fortran/59599
        * gfortran.dg/ichar_3.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@208043 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/ichar_3.f90 [new file with mode: 0644]

index 9a39dcc..a11df7b 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-22  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/59599
+       * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Calculate the
+       number of arguments.
+
 2014-02-20  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from mainline
index f7afb78..89dbb01 100644 (file)
@@ -4665,8 +4665,10 @@ static void
 gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr)
 {
   tree args[2], type, pchartype;
+  int nargs;
 
-  gfc_conv_intrinsic_function_args (se, expr, args, 2);
+  nargs = gfc_intrinsic_argument_list_length (expr);
+  gfc_conv_intrinsic_function_args (se, expr, args, nargs);
   gcc_assert (POINTER_TYPE_P (TREE_TYPE (args[1])));
   pchartype = gfc_get_pchar_type (expr->value.function.actual->expr->ts.kind);
   args[1] = fold_build1_loc (input_location, NOP_EXPR, pchartype, args[1]);
index beaf109..fc5526c 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-22  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/59599
+       * gfortran.dg/ichar_3.f90: New test.
+
 2014-02-20  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/ichar_3.f90 b/gcc/testsuite/gfortran.dg/ichar_3.f90
new file mode 100644 (file)
index 0000000..d0f5c8b
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+!
+! PR fortran/59599
+! The call to ichar was triggering an ICE.
+!
+! Original testcase from Fran Martinez Fadrique <fmartinez@gmv.com>
+
+character(1) cpk(2)
+integer res(2)
+cpk = 'a'
+res = ichar( cpk, kind=1 )
+print *, ichar( cpk, kind=1 )
+end