public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59599] New: Compiler internal error on intrinsic ichar
@ 2013-12-25 20:24 fmartinez at gmv dot com
  2014-02-08 19:45 ` [Bug fortran/59599] " fmartinez at gmv dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: fmartinez at gmv dot com @ 2013-12-25 20:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59599
           Summary: Compiler internal error on intrinsic ichar
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fmartinez at gmv dot com

Created attachment 31513
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31513&action=edit
Source code generatin the execption

When using the optional paramenter kind in the invocation of intrinsic function
ichar the following exception is thrown:

m_util_convert.f90:767:0: internal compiler error: in gfc_trans_assignment_1,
at fortran/trans-expr.c:8006
   res = ichar( cpk, kind=1 )
 ^

Source file attached


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
@ 2014-02-08 19:45 ` fmartinez at gmv dot com
  2014-02-08 21:55 ` mikael at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fmartinez at gmv dot com @ 2014-02-08 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Fran Martinez Fadrique <fmartinez at gmv dot com> ---
*** Bug 60118 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
  2014-02-08 19:45 ` [Bug fortran/59599] " fmartinez at gmv dot com
@ 2014-02-08 21:55 ` mikael at gcc dot gnu.org
  2014-02-08 21:58 ` mikael at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-08 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
in trans-intrinsic's gfc_conv_intrinsic_function_args:

      if (e->ts.type == BT_CHARACTER)
    {
      gfc_conv_expr (&argse, e);
      gfc_conv_string_parameter (&argse);
          argarray[curr_arg++] = argse.string_length;
      gcc_assert (curr_arg < nargs);
    }

we evaluate the string lenth into argarray[curr_arg], but argarray[curr_arg] is
supposed to be the place where the next function argument lies.  So in the
testcase, we don't evaluate the "kind" argument to "ichar" and all hell breaks
loose from that.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
  2014-02-08 19:45 ` [Bug fortran/59599] " fmartinez at gmv dot com
  2014-02-08 21:55 ` mikael at gcc dot gnu.org
@ 2014-02-08 21:58 ` mikael at gcc dot gnu.org
  2014-02-08 22:12 ` mikael at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-08 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #3)
> we evaluate the string lenth into argarray[curr_arg],
s/lenth/length/

> but argarray[curr_arg]
> is supposed to be the place where the next function argument lies.
To be clear: it's the place where the next function argument will be put once
evaluated, but we don't get to that point because curr_arg is bumped and we
have the wanted number of arguments.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (2 preceding siblings ...)
  2014-02-08 21:58 ` mikael at gcc dot gnu.org
@ 2014-02-08 22:12 ` mikael at gcc dot gnu.org
  2014-02-08 22:19 ` mikael at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-08 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
Patch:

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 1eb9490..1e1a137 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4690,7 +4690,7 @@ gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr)
 {
   tree args[2], type, pchartype;

-  gfc_conv_intrinsic_function_args (se, expr, args, 2);
+  gfc_conv_intrinsic_function_args (se, expr, args, 3);
   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]);


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (3 preceding siblings ...)
  2014-02-08 22:12 ` mikael at gcc dot gnu.org
@ 2014-02-08 22:19 ` mikael at gcc dot gnu.org
  2014-02-08 22:27 ` mikael at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-08 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #5)
> Patch:
> 
doesn't work. :-(


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (4 preceding siblings ...)
  2014-02-08 22:19 ` mikael at gcc dot gnu.org
@ 2014-02-08 22:27 ` mikael at gcc dot gnu.org
  2014-02-15 11:49 ` mikael at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-08 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #6)
> (In reply to Mikael Morin from comment #5)
> > Patch:
> > 
> doesn't work. :-(

ichar's kind argument is optional, so passing a constant number of arguments to
gfc_conv_intrinsic_function_args is bogus.
This is a stage1 bug anyway (non-regression).

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 1eb9490..cff8e89 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4689,8 +4689,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]);


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (5 preceding siblings ...)
  2014-02-08 22:27 ` mikael at gcc dot gnu.org
@ 2014-02-15 11:49 ` mikael at gcc dot gnu.org
  2014-02-22 12:22 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-15 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Feb 15 11:48:41 2014
New Revision: 207799

URL: http://gcc.gnu.org/viewcvs?rev=207799&root=gcc&view=rev
Log:
fortran/
        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.


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (6 preceding siblings ...)
  2014-02-15 11:49 ` mikael at gcc dot gnu.org
@ 2014-02-22 12:22 ` mikael at gcc dot gnu.org
  2014-02-22 12:42 ` mikael at gcc dot gnu.org
  2014-02-22 12:45 ` mikael at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-22 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Feb 22 12:22:17 2014
New Revision: 208042

URL: http://gcc.gnu.org/viewcvs?rev=208042&root=gcc&view=rev
Log:
fortran/
        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.


Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/ichar_3.f90
Modified:
    branches/gcc-4_8-branch/gcc/fortran/ChangeLog
    branches/gcc-4_8-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (7 preceding siblings ...)
  2014-02-22 12:22 ` mikael at gcc dot gnu.org
@ 2014-02-22 12:42 ` mikael at gcc dot gnu.org
  2014-02-22 12:45 ` mikael at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-22 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Feb 22 12:41:53 2014
New Revision: 208043

URL: http://gcc.gnu.org/viewcvs?rev=208043&root=gcc&view=rev
Log:
fortran/
        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.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/ichar_3.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/59599] Compiler internal error on intrinsic ichar
  2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
                   ` (8 preceding siblings ...)
  2014-02-22 12:42 ` mikael at gcc dot gnu.org
@ 2014-02-22 12:45 ` mikael at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-02-22 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |mikael at gcc dot gnu.org

--- Comment #11 from Mikael Morin <mikael at gcc dot gnu.org> ---
Bug fixed for 4.7.4, 4.8.3 and 4.9.0.
Thanks for reporting it.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-02-22 12:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-25 20:24 [Bug fortran/59599] New: Compiler internal error on intrinsic ichar fmartinez at gmv dot com
2014-02-08 19:45 ` [Bug fortran/59599] " fmartinez at gmv dot com
2014-02-08 21:55 ` mikael at gcc dot gnu.org
2014-02-08 21:58 ` mikael at gcc dot gnu.org
2014-02-08 22:12 ` mikael at gcc dot gnu.org
2014-02-08 22:19 ` mikael at gcc dot gnu.org
2014-02-08 22:27 ` mikael at gcc dot gnu.org
2014-02-15 11:49 ` mikael at gcc dot gnu.org
2014-02-22 12:22 ` mikael at gcc dot gnu.org
2014-02-22 12:42 ` mikael at gcc dot gnu.org
2014-02-22 12:45 ` mikael at gcc dot gnu.org

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