public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
@ 2013-01-13  9:51 janus at gcc dot gnu.org
  2013-01-13  9:59 ` [Bug fortran/55959] " janus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-13  9:51 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55959
           Summary: [OOP] ICE in in gfc_simplify_expr, at
                    fortran/expr.c:1920
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Reported at http://gcc.gnu.org/ml/fortran/2013-01/msg00108.html.

Corrected test case:

module pdfs
    type, abstract :: pdf
        integer dims
    contains
        procedure(getx), deferred :: getx
    end type pdf

    abstract interface
    function getx(this)
        import pdf
        class(pdf), intent(in) :: this
        real getx(this%dims)
    end function getx
    end interface

    type point
        real x, y
    end type point

    type, extends(pdf) :: pdf_point
        type(point) p
    contains
        procedure :: getx => pdf_point_getx
    end type pdf_point

contains

    function pdf_point_getx(this)
        class(pdf_point), intent(in) :: this
        real pdf_point_getx(this%dims)
        pdf_point_getx(1) = this%p%x
        pdf_point_getx(2) = this%p%y
    end function pdf_point_getx

end module pdfs


program abstract
    use pdfs
    type(pdf_point) pp
    namelist /nml_pp/ pp

    print nml_pp
    print pp%getx()

end program abstract 



This produces the following ICE:

f951: internal compiler error: in gfc_simplify_expr, at fortran/expr.c:1920
0x5751ca gfc_simplify_expr(gfc_expr*, int)
        /home/jweil/gcc48/trunk/gcc/fortran/expr.c:1920
0x59ef2a check_io_constraints
        /home/jweil/gcc48/trunk/gcc/fortran/io.c:3560
0x59f50e match_io
        /home/jweil/gcc48/trunk/gcc/fortran/io.c:3758
0x59f60c gfc_match_print()
        /home/jweil/gcc48/trunk/gcc/fortran/io.c:3802
0x5c6c83 match_word
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:65
0x5c8287 decode_statement
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:466
0x5c91d6 next_free
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:777
0x5c9632 next_statement
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:970
0x5cd343 parse_executable
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:3914
0x5cda67 parse_progunit
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:4144
0x5ce590 gfc_parse_file()
        /home/jweil/gcc48/trunk/gcc/fortran/parse.c:4548
0x61b4c1 gfc_be_parse_file
        /home/jweil/gcc48/trunk/gcc/fortran/f95-lang.c:189


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
@ 2013-01-13  9:59 ` janus at gcc dot gnu.org
  2013-01-13 13:01 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-13  9:59 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from janus at gcc dot gnu.org 2013-01-13 09:58:49 UTC ---
Reduced test case:

module pdfs
  type :: pdf
  contains
    procedure, nopass :: getx
  end type pdf

contains

  real function getx()
  end function

end module pdfs

program abstract
  use pdfs
  type(pdf) pp
  print pp%getx()
end program


When changing the print line into

  print getx()

the ICE turns into the correct error message:

  print getx()
       1
Error: FORMAT tag at (1) must be of type default-kind CHARACTER or of INTEGER


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
  2013-01-13  9:59 ` [Bug fortran/55959] " janus at gcc dot gnu.org
@ 2013-01-13 13:01 ` dominiq at lps dot ens.fr
  2013-01-13 13:07 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-13 13:01 UTC (permalink / raw)
  To: gcc-bugs


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-13
     Ever Confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-13 13:01:19 UTC ---
> Reported at http://gcc.gnu.org/ml/fortran/2013-01/msg00108.html.

With the original case I got an ICE up to revision 190090 (2012-08-02) and the
errors after revision 190271 (2012-08-09). In this range I see a set of patches
from Mikael, starting at r190092, and r190187 for pr35831.


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
  2013-01-13  9:59 ` [Bug fortran/55959] " janus at gcc dot gnu.org
  2013-01-13 13:01 ` dominiq at lps dot ens.fr
@ 2013-01-13 13:07 ` janus at gcc dot gnu.org
  2013-01-30 13:29 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-13 13:07 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from janus at gcc dot gnu.org 2013-01-13 13:07:01 UTC ---
Apparently it is trivially fixed by this patch:

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (revision 195125)
+++ gcc/fortran/expr.c    (working copy)
@@ -1917,7 +1917,6 @@ gfc_simplify_expr (gfc_expr *p, int type)

     case EXPR_COMPCALL:
     case EXPR_PPC:
-      gcc_unreachable ();
       break;
     }


Reason: Usually gfc_simplify_expr is never called on EXPR_COMPCALL, because it
is transformed into EXPR_FUNCTION at resolution time.

In io.c (check_io_constraints), gfc_simplify_expr is already called at parsing
time (see backtrace).


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-01-13 13:07 ` janus at gcc dot gnu.org
@ 2013-01-30 13:29 ` dominiq at lps dot ens.fr
  2013-04-12 19:10 ` janus at gcc dot gnu.org
  2013-04-13 11:06 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-30 13:29 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-30 13:28:58 UTC ---
The behavior of the test in comment #0 modified with the following patch

--- pr55959.f90    2013-01-13 12:23:04.000000000 +0100
+++ pr55959_0_db.f90    2013-01-13 12:43:43.000000000 +0100
@@ -27,7 +27,8 @@ contains

     function pdf_point_getx(this)
         class(pdf_point), intent(in) :: this
-        real pdf_point_getx(this%dims)
+!        real pdf_point_getx(2)
+        real, dimension(getdims(this)) :: pdf_point_getx(x)
         pdf_point_getx(1) = this%p%x
         pdf_point_getx(2) = this%p%y
     end function pdf_point_getx
@@ -40,7 +41,8 @@ program abstract
     type(pdf_point) pp
     namelist /nml_pp/ pp

-    print nml_pp
-    print pp%getx()
+    print *, nml_pp
+    print *, pp%getx()
+contains

-end program abstract 
+end program abstract

has changed from

pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
f951: internal compiler error: in replace_comp, at fortran/expr.c:4356

f951: internal compiler error: Abort trap
gfortran: internal compiler error: Abort trap (program f951)
Abort

with revision 195548, to

pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
pr55959_0_db.f90:31.57:

        real, dimension(getdims(this)) :: pdf_point_getx(x)
                                                         1
Error: Expression at (1) must be of INTEGER type, found REAL
pr55959_0_db.f90:40.8:

    use pdfs
        1
Fatal Error: Can't open module file 'pdfs.mod' for reading at (1): No such file
or directory

with revision 195570 (likely due to r 195562), i.e., the ICE is gone, but the
error is duplicated 5 times.

Same thing with the following change

--- pr55959.f90    2013-01-13 12:23:04.000000000 +0100
+++ pr55959_0_db_1.f90    2013-01-13 12:45:10.000000000 +0100
@@ -27,7 +27,8 @@ contains

     function pdf_point_getx(this)
         class(pdf_point), intent(in) :: this
-        real pdf_point_getx(this%dims)
+!        real pdf_point_getx(2)
+        real, dimension(getdims(this)) :: pdf_point_getx
         pdf_point_getx(1) = this%p%x
         pdf_point_getx(2) = this%p%y
     end function pdf_point_getx
@@ -40,7 +41,8 @@ program abstract
     type(pdf_point) pp
     namelist /nml_pp/ pp

-    print nml_pp
-    print pp%getx()
+    print *, nml_pp
+    print *, pp%getx()
+contains

-end program abstract 
+end program abstract


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-01-30 13:29 ` dominiq at lps dot ens.fr
@ 2013-04-12 19:10 ` janus at gcc dot gnu.org
  2013-04-13 11:06 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-04-12 19:10 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from janus at gcc dot gnu.org 2013-04-12 19:10:29 UTC ---
In 4.8 and trunk, there is an additional problem with the test case in comment
0, see PR 56939.


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

* [Bug fortran/55959] [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920
  2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-04-12 19:10 ` janus at gcc dot gnu.org
@ 2013-04-13 11:06 ` janus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-04-13 11:06 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

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

--- Comment #6 from janus at gcc dot gnu.org 2013-04-13 11:06:15 UTC ---
r197943 fixes the original ICE and makes comment 1 work as expected on 4.9
trunk:

gcc.gnu.org/viewcvs/gcc?view=revision&revision=197943


Author:     janus
Date:     Sat Apr 13 10:52:31 2013 UTC
Changed paths:     4
Log Message:     

2013-04-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55959
    * expr.c (gfc_simplify_expr): Branch is not unreachable.


2013-04-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55959
    * gfortran.dg/typebound_proc_29.f03: New.



Since the remaining issue of comment 0 is tracked by PR56939, I think we can
close this one (apart from the duplicate error messages mentioned in comment 4,
but similar problems are tracked by PR 44978, where I will leave a note about
the test case here).


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

end of thread, other threads:[~2013-04-13 11:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-13  9:51 [Bug fortran/55959] New: [OOP] ICE in in gfc_simplify_expr, at fortran/expr.c:1920 janus at gcc dot gnu.org
2013-01-13  9:59 ` [Bug fortran/55959] " janus at gcc dot gnu.org
2013-01-13 13:01 ` dominiq at lps dot ens.fr
2013-01-13 13:07 ` janus at gcc dot gnu.org
2013-01-30 13:29 ` dominiq at lps dot ens.fr
2013-04-12 19:10 ` janus at gcc dot gnu.org
2013-04-13 11:06 ` janus 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).