public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/24557]  New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
@ 2005-10-27 11:16 eedelman at gcc dot gnu dot org
  2005-10-27 22:00 ` [Bug fortran/24557] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-10-27 11:16 UTC (permalink / raw)
  To: gcc-bugs

kl-nrb:~$ cat buggy.f90 
program main
  implicit none
  character(4) :: a(2)
  print *,fun(a)
contains
  function fun(arg)
    character(len=*), intent(in) :: arg(:)
    integer :: fun(size(arg))
    fun = 5
  end function fun
end pkl-nrb:~$ gfortran41 buggy.f90 
buggy.f90:4: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

If I change the length of 'arg' to a constant it works, and if I assign the
function result to a temporary variable before I print, it also works.


-- 
           Summary: ICE: PRINTing function result of size depending on
                    assumed length CHARACTER dummy
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eedelman at gcc dot gnu dot org


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


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
@ 2005-10-27 22:00 ` pinskia at gcc dot gnu dot org
  2006-01-25 14:52 ` paul dot richard dot thomas at cea dot fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-27 22:00 -------
Confirmed, backtace:
#0  0x080ffa9b in convert_nonlocal_reference (tp=0xb7c6cabc,
walk_subtrees=0xbfe14468, data=0xbfe14538)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:829
#1  0x0836eea5 in walk_tree (tp=0xb7c6cabc, func=0x80ff9f0
<convert_nonlocal_reference>, data=0xbfe14538, 
    pset=0x0) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree.c:7094
#2  0x080fce05 in walk_stmts (wi=0xbfe14538, tp=Variable "tp" is not available.
)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:612
#3  0x080fced0 in walk_stmts (wi=0xbfe14538, tp=Variable "tp" is not available.
)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:580
#4  0x080fced0 in walk_stmts (wi=0xbfe14538, tp=Variable "tp" is not available.
)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:580
#5  0x080fd40f in walk_function (callback=Variable "callback" is not available.
) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:643
#6  0x080fd477 in walk_all_functions (callback=0x80ff9f0
<convert_nonlocal_reference>, root=0xb7c2f820)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:655
#7  0x080feeac in lower_nested_functions (fndecl=0xb7c69c80)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/tree-nested.c:1513
#8  0x083e7a49 in cgraph_finalize_function (decl=0xb7c69c80, nested=0 '\0')
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/cgraphunit.c:431
#9  0x080abaf3 in gfc_generate_function_code (ns=0x876b7f8)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/fortran/trans-decl.c:2675
#10 0x0809a104 in gfc_generate_code (ns=0x876b7f8)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/fortran/trans.c:683
#11 0x0807ebad in gfc_parse_file () at
/home/peshtigo/pinskia/src/gnu/gcc/src/gcc/fortran/parse.c:2589


-- 

pinskia 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         |2005-10-27 22:00:08
               date|                            |
            Summary|ICE: PRINTing function      |ICE: PRINTing function
                   |result of size depending on |result of size depending on
                   |assumed length CHARACTER    |assumed length CHARACTER
                   |dummy                       |dummy


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


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
  2005-10-27 22:00 ` [Bug fortran/24557] " pinskia at gcc dot gnu dot org
@ 2006-01-25 14:52 ` paul dot richard dot thomas at cea dot fr
  2006-02-06 13:51 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-01-25 14:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paul dot richard dot thomas at cea dot fr  2006-01-25 14:52 -------
The code is really crazy for this example. Please note that I have Jakub's
nongomp type patch in place.  This bug is independent of the completeness of
the types, however.

The problem is that the character length of the DUMMY argument is somehow being
referenced in the main program.  This aberrant behaviour is somehow associated
with the IO transfer.

MAIN__ ()
{
  char a[2][1:4];
  static void fun (struct array1_int4 &, struct array1_unknown &, int4);

  {
    struct __st_parameter_dt dt_parm.8;

    dt_parm.8.common.filename = "pr24557.f90";
    dt_parm.8.common.line = 5;
    dt_parm.8.common.unit = 6;
    dt_parm.8.common.flags = 128;
    _gfortran_st_write (&dt_parm.8);
    {
      void * D.840;
      int4 D.839;
      struct array1_int4 atmp.12;
      int4 D.837;
      int4 D.836;
      int4 D.835;
      struct array1_unknown parm.11;
      int4 D.833;
      int4 D.832;
      char[0:][1:_arg] * parm.10;      /******Here******/
      struct array1_unknown * D.830;
      struct array1_unknown parm.9;

      parm.9.dtype = 305;
      parm.9.dim[0].lbound = 1;
      parm.9.dim[0].ubound = 2;
      parm.9.dim[0].stride = 1;
      parm.9.data = (void *) (char[0:][1:4] *) &a[0];
      parm.9.offset = 0;
      D.830 = &parm.9;
      parm.10 = (char[0:][1:_arg] *) (char[0:][1:4] *) D.830->data; /*Here*/
      D.832 = D.830->dim[0].ubound - D.830->dim[0].lbound + 1;
      D.833 = -D.830->dim[0].stride;
      parm.11.dtype = ((<unnamed type>) _arg << 6) + 49;    /***and here***/
      D.835 = D.830->dim[0].stride;
      parm.11.dim[0].lbound = 1;
      parm.11.dim[0].ubound = D.832;
      parm.11.dim[0].stride = NON_LVALUE_EXPR <D.835>;
      parm.11.data = (void *) (char[0:][1:_arg] *) &(*parm.10)[0];  /*here*/
      parm.11.offset = 0;
      D.836 = _gfortran_size0 (&parm.11);
      D.837 = D.836 - 1;
      atmp.12.dtype = 265;
      atmp.12.dim[0].stride = 1;
      atmp.12.dim[0].lbound = 0;
      atmp.12.dim[0].ubound = NON_LVALUE_EXPR <D.837>;
      D.839 = NON_LVALUE_EXPR <D.837> + 1;
      D.840 = _gfortran_internal_malloc (D.839 * 4);
      atmp.12.data = D.840;
      atmp.12.offset = 0;
      atmp.12.dim[0].stride = 0;
      fun (&atmp.12, D.830, 4);        /* After the call, all is well.*/

Paul


-- 


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


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
  2005-10-27 22:00 ` [Bug fortran/24557] " pinskia at gcc dot gnu dot org
  2006-01-25 14:52 ` paul dot richard dot thomas at cea dot fr
@ 2006-02-06 13:51 ` pinskia at gcc dot gnu dot org
  2006-02-16  7:04 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-06 13:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-02-06 13:51 -------
Assigning to Paul based on a request made in a private email.


-- 

pinskia 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=24557


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-02-06 13:51 ` pinskia at gcc dot gnu dot org
@ 2006-02-16  7:04 ` pault at gcc dot gnu dot org
  2006-02-16  7:07 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-02-16  7:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-02-16 07:04 -------
Subject: Bug 24557

Author: pault
Date: Thu Feb 16 07:04:13 2006
New Revision: 111130

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111130
Log:
2005-02-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24557
        * trans-expr.c (gfc_add_interface_mapping): Use the actual argument
        for character(*) arrays, rather than casting to the type and kind
        parameters of the formal argument.

2005-02-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24557
        * gfortran.dg/assumed_charlen_needed_1.f90: New test.


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


-- 


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


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-02-16  7:04 ` pault at gcc dot gnu dot org
@ 2006-02-16  7:07 ` pault at gcc dot gnu dot org
  2006-03-07  0:07 ` pault at gcc dot gnu dot org
  2006-03-07  2:24 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-02-16  7:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-02-16 07:07 -------
Fixed on trunk - I'll do 4.1 just as soon as it re-opens.

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=24557


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-02-16  7:07 ` pault at gcc dot gnu dot org
@ 2006-03-07  0:07 ` pault at gcc dot gnu dot org
  2006-03-07  2:24 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-03-07  0:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-03-07 00:06 -------
Subject: Bug 24557

Author: pault
Date: Tue Mar  7 00:06:37 2006
New Revision: 111796

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111796
Log:
2006-03-07  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/26107
        * resolve.c (resolve_function): Add name after test for pureness.

        * iresolve.c (gfc_resolve_dot_product):  Remove any difference in
        treatment of logical types.
        * trans-intrinsic.c (gfc_conv_intrinsic_dot_product):  New function. 

        PR fortran/26393
        * trans-decl.c (gfc_get_symbol_decl): Extend condition that symbols
        must be referenced to include unreferenced symbols in an interface
        body. 

        PR fortran/20938
        * trans-array.c (gfc_conv_resolve_dependencies): Add call to
        gfc_are_equivalenced_arrays.
        * symbol.c (gfc_free_equiv_infos, gfc_free_equiv_lists): New
        functions. (gfc_free_namespace): Call them.
        * trans-common.c (copy_equiv_list_to_ns): New function.
        (add_equivalences): Call it.
        * gfortran.h: Add equiv_lists to gfc_namespace and define
        gfc_equiv_list and gfc_equiv_info.
        * dependency.c (gfc_are_equivalenced_arrays): New function.
        (gfc_check_dependency): Call it.
        * dependency.h: Prototype for gfc_are_equivalenced_arrays.

        PR fortran/24519
        * dependency.c (gfc_is_same_range): Correct typo.
        (gfc_check_section_vs_section): Call gfc_is_same_range.

        PR fortran/25395
        * trans-common.c (add_equivalences): Add a new flag that is set when
        an equivalence is seen that prevents more from being reset until the
        start of a new traversal of the list, thus ensuring completion of
        all the equivalences.

        PR fortran/25054
        * resolve.c (is_non_constant_shape_array): New function.
        (resolve_fl_variable): Remove code for the new function and call it.
        (resolve_fl_namelist): New function.  Add test for namelist array
        with non-constant shape, using is_non_constant_shape_array.
        (resolve_symbol): Remove code for resolve_fl_namelist and call it.

        PR fortran/25089
        * match.c (match_namelist): Increment the refs field of an accepted
        namelist object symbol.
        * resolve.c (resolve_fl_namelist): Test namelist objects for a conflict
        with contained or module procedures.

        PR fortran/24557
        * trans-expr.c (gfc_add_interface_mapping): Use the actual argument
        for character(*) arrays, rather than casting to the type and kind
        parameters of the formal argument.

2006-03-07  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/26107
        * resolve.c (resolve_function): Add name after test for pureness.

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

        PR fortran/26393
        * gfortran.dg/used_interface_ref.f90: New test.

        PR fortran/20938
        * gfortran.dg/dependency_2.f90: New test.
        * gfortran.fortran-torture/execute/where17.f90: New test.
        * gfortran.fortran-torture/execute/where18.f90: New test.
        * gfortran.fortran-torture/execute/where19.f90: New test.
        * gfortran.fortran-torture/execute/where20.f90: New test.

        PR fortran/24519
        * gfortran.dg/dependency_3.f90: New test.
        * gfortran.fortran-torture/execute/vect-3.f90: Remove two of the
        XFAILs.

        PR fortran/25395
        * gfortran.dg/equiv_6.f90: New test.

        PR fortran/25054
        * gfortran.dg/namelist_5.f90: New test.

        PR fortran/25089
        * gfortran.dg/namelist_4.f90: New test.

        PR fortran/24557
        * gfortran.dg/assumed_charlen_needed_1.f90: New test.

Added:
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_needed_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dependency_2.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/dependency_3.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/equiv_6.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/logical_dot_product.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_5.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/pure_dummy_length_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_interface_ref.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where17.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where18.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where19.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.fortran-torture/execute/where20.f90
Modified:
    branches/gcc-4_1-branch/MAINTAINERS
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/dependency.c
    branches/gcc-4_1-branch/gcc/fortran/dependency.h
    branches/gcc-4_1-branch/gcc/fortran/dump-parse-tree.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/iresolve.c
    branches/gcc-4_1-branch/gcc/fortran/match.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/symbol.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-common.c
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/vect/vect-3.f90


-- 


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


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

* [Bug fortran/24557] ICE: PRINTing function result of size depending on assumed length CHARACTER dummy
  2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-03-07  0:07 ` pault at gcc dot gnu dot org
@ 2006-03-07  2:24 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-07  2:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.1


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


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

end of thread, other threads:[~2006-03-07  2:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 11:16 [Bug fortran/24557] New: ICE: PRINTing function result of size depending on assumed length CHARACTER dummy eedelman at gcc dot gnu dot org
2005-10-27 22:00 ` [Bug fortran/24557] " pinskia at gcc dot gnu dot org
2006-01-25 14:52 ` paul dot richard dot thomas at cea dot fr
2006-02-06 13:51 ` pinskia at gcc dot gnu dot org
2006-02-16  7:04 ` pault at gcc dot gnu dot org
2006-02-16  7:07 ` pault at gcc dot gnu dot org
2006-03-07  0:07 ` pault at gcc dot gnu dot org
2006-03-07  2:24 ` pinskia 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).