public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32129]  New: ICE: Procedure call with array-section-actual to scalar dummy
@ 2007-05-28 17:07 burnus at gcc dot gnu dot org
  2007-05-28 18:13 ` [Bug fortran/32129] " burnus at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-28 17:07 UTC (permalink / raw)
  To: gcc-bugs

This is kind of a split up of PR31564, which is unrelated.

The program is invalid as we pass an array as actual argument to the scalar
dummy argument; somehow gfortran does not detect this.

Interestingly, compare_actual_formal is never called if the actual argument is
an array section with non-expr-constant bounds. If it is a single element, or
the whole array or has e.g. bounds "1:1" or "1:2" everything is caught and goes
through compare_actual_formal, except for ":which", "1:which" etc.

The ICE is:
x.f90: In function 'cdf_beta':
x.f90:16: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:321


Testcase, from PR 31564 modified to produce invalid code.

    MODULE cdf_aux_mod
      TYPE :: the_distribution
        INTEGER :: parameters(1)
      END TYPE the_distribution
      TYPE (the_distribution), PARAMETER :: the_beta = the_distribution((/0/))
    CONTAINS
      SUBROUTINE set_bound(arg_name)
        INTEGER, INTENT (IN) :: arg_name
      END SUBROUTINE set_bound
    END MODULE cdf_aux_mod
    MODULE cdf_beta_mod
    CONTAINS
      SUBROUTINE cdf_beta()
        USE cdf_aux_mod
        INTEGER :: which
          which = 1
          CALL set_bound(the_beta%parameters(1:which))
      END SUBROUTINE cdf_beta
    END MODULE cdf_beta_mod


-- 
           Summary: ICE: Procedure call with array-section-actual to scalar
                    dummy
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
@ 2007-05-28 18:13 ` burnus at gcc dot gnu dot org
  2007-05-31 11:57 ` fxcoudert at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-28 18:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-05-28 18:13 -------
Some debugging shows:

resolve_call calls resolve_actual_arglist, which fails. 
resolve_call propagates the failure to resolve_where, which does not check for
errors.

In resolve_actual_arglist it fails here:

      if (e->ts.type != BT_PROCEDURE)
        {
          if (gfc_resolve_expr (e) != SUCCESS)
            return FAILURE;


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
  2007-05-28 18:13 ` [Bug fortran/32129] " burnus at gcc dot gnu dot org
@ 2007-05-31 11:57 ` fxcoudert at gcc dot gnu dot org
  2007-06-02  0:06 ` mikael dot morin at tele2 dot fr
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-31 11:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-31 11:57:03
               date|                            |


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
  2007-05-28 18:13 ` [Bug fortran/32129] " burnus at gcc dot gnu dot org
  2007-05-31 11:57 ` fxcoudert at gcc dot gnu dot org
@ 2007-06-02  0:06 ` mikael dot morin at tele2 dot fr
  2007-10-21  3:29 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mikael dot morin at tele2 dot fr @ 2007-06-02  0:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mikael dot morin at tele2 dot fr  2007-06-02 00:06 -------
Here is an other test case. 

      program testCode
      implicit none 
      type vec
              real, dimension(3) :: coords
      end type
      integer, parameter :: n = 5
      integer :: i
      real, dimension(3, n), parameter :: vy =
     &  reshape( (/ (1.d0, i=1,3*n) /), shape = (/ 3, n /))

      i = 1
      call Sub(vec(vy(:,i)))

      contains

      subroutine Sub(xin)
      type(vec)       :: xin
      intent(in)  xin

      print*, xin

      end subroutine
      end program


This program produce an ICE (in gfc_trans_call, at fortran/trans-stmt.c:321)

But if vy is a normal variable (not a parameter), it works.
And it works also if we use vy(:,1) instead of vy(:,i). 

Hoping it helps... 


-- 

mikael dot morin at tele2 dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael dot morin at tele2
                   |                            |dot fr


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-02  0:06 ` mikael dot morin at tele2 dot fr
@ 2007-10-21  3:29 ` jvdelisle at gcc dot gnu dot org
  2007-11-21 13:52 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-10-21  3:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-10-21 03:29 -------
The original test case here no longer gives an ICE.

The case on Comment #2 does ICE

pr32129-a.f90: In function ‘MAIN__’:
pr32129-a.f90:11: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:320


-- 


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-21  3:29 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-21 13:52 ` fxcoudert at gcc dot gnu dot org
  2007-12-07 11:48 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-11-21 13:52 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-11-21 13:51 -------
I think this is valid code. The reduced testcase is:

$ cat y.f90
program testCode
  implicit none
  type vec
    real, dimension(1) :: coords
  end type
  integer :: i
  real, dimension(1,1), parameter :: vy = 1.

  i = 1
  call Sub(vec(vy(:,i)))

contains

  subroutine Sub(xin)
    type(vec) :: xin
    intent(in)  xin

    print*, xin
  end subroutine
end program
$ gfortran y.f90
y.f90: In function ‘testcode’:
y.f90:9: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:321


But it also happens with external functions:
$ cat y2.f90
  implicit none
  type vec
    integer, dimension(1) :: coords
  end type
  integer :: i
  integer, dimension(1,1), parameter :: vy = 0

  i = 1
  call shape(vec(vy(:,i)))
end program
$ gfortran y2.f90
y2.f90: In function ‘MAIN__’:
y2.f90:8: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:321


And it's actually a nice area for bugs to creep in:

$ cat y3.f90
  integer, parameter :: vy(1,1) = 0
  type vec
    integer :: coords(1)
  end type
  integer :: i

  i = 1
  print *, shape(vec(vy(:,i)))
end program
$ gfortran y3.f90
y3.f90: In function ‘MAIN__’:
y3.f90:7: internal compiler error: Bad IO basetype (1)



$ cat y4.f90
  implicit none
  type vec
    integer, dimension(1) :: coords
  end type
  integer :: i
  integer, dimension(1,1), parameter :: vy = 0

  i = 1
  print *, shape(vec(vy(:,i)))
end program
$ gfortran y4.f90
y2.f90: In function ‘MAIN__’:
y2.f90:8: internal compiler error: in gfc_typenode_for_spec, at
fortran/trans-types.c:841


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
           Keywords|ice-on-invalid-code         |ice-on-valid-code
   Last reconfirmed|2007-05-31 11:57:03         |2007-11-21 13:51:56
               date|                            |


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-11-21 13:52 ` fxcoudert at gcc dot gnu dot org
@ 2007-12-07 11:48 ` pault at gcc dot gnu dot org
  2007-12-07 13:46 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-07 11:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2007-12-07 11:48 -------
Created an attachment (id=14707)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14707&action=view)
Fix for the PR

This is just regtesting but I think that it will be OK.

Note that this expression type was getting mangled in simplification.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-12-07 11:48 ` pault at gcc dot gnu dot org
@ 2007-12-07 13:46 ` pault at gcc dot gnu dot org
  2007-12-08 20:45 ` dominiq at lps dot ens dot fr
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-07 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2007-12-07 13:46 -------
(In reply to comment #5)

> This is just regtesting but I think that it will be OK.

Famous last words! It regresses in elemental_subroutine_2.f90.  It should all
be fixable witout much effort, though.

Paul


-- 


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-12-07 13:46 ` pault at gcc dot gnu dot org
@ 2007-12-08 20:45 ` dominiq at lps dot ens dot fr
  2007-12-09  9:17 ` pault at gcc dot gnu dot org
  2007-12-09  9:20 ` pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-12-08 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dominiq at lps dot ens dot fr  2007-12-08 20:45 -------
Now works as advertized without regression on i686-apple-darwin9.


-- 


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-12-08 20:45 ` dominiq at lps dot ens dot fr
@ 2007-12-09  9:17 ` pault at gcc dot gnu dot org
  2007-12-09  9:20 ` pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-09  9:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2007-12-09 09:17 -------
Subject: Bug 32129

Author: pault
Date: Sun Dec  9 09:17:24 2007
New Revision: 130719

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130719
Log:
2007-12-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32129
        * dump-parse-tree.c (gfc_show_expr_n): New function for
        debugging.
        * gfortran.h : Add prototype for gfc_show_expr_n.
        * expr.c (simplify_constructor): Copy the constructor
        expression and try to simplify that.  If success, replace the
        original.  Otherwise discard the copy, keep going through
        the structure and return success.

        PR fortran/31487
        * decl.c (build_struct): Pad out default initializers with
        spaces to the component character length.

2007-12-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32129
        * gfortran.dg/derived_comp_array_ref_6.f90: New test.
        * gfortran.dg/derived_comp_array_ref_7.f90: New test.

        PR fortran/31487
        * gfortran.dg/char_component_initializer_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/char_component_initializer_1.f90
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_6.f90
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32129] ICE: Procedure call with array-section-actual to scalar dummy
  2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-12-09  9:17 ` pault at gcc dot gnu dot org
@ 2007-12-09  9:20 ` pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-09  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2007-12-09 09:19 -------
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-12-09  9:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-28 17:07 [Bug fortran/32129] New: ICE: Procedure call with array-section-actual to scalar dummy burnus at gcc dot gnu dot org
2007-05-28 18:13 ` [Bug fortran/32129] " burnus at gcc dot gnu dot org
2007-05-31 11:57 ` fxcoudert at gcc dot gnu dot org
2007-06-02  0:06 ` mikael dot morin at tele2 dot fr
2007-10-21  3:29 ` jvdelisle at gcc dot gnu dot org
2007-11-21 13:52 ` fxcoudert at gcc dot gnu dot org
2007-12-07 11:48 ` pault at gcc dot gnu dot org
2007-12-07 13:46 ` pault at gcc dot gnu dot org
2007-12-08 20:45 ` dominiq at lps dot ens dot fr
2007-12-09  9:17 ` pault at gcc dot gnu dot org
2007-12-09  9:20 ` pault at gcc dot gnu dot 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).