Bug 30202 - [4.1 only] ICE in trans-array.c
Summary: [4.1 only] ICE in trans-array.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Paul Thomas
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-12-13 16:38 UTC by Salvatore Filippone
Modified: 2007-01-10 19:00 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.2.0 4.3.0
Last reconfirmed: 2006-12-20 21:39:12


Attachments
test case (712 bytes, text/plain)
2006-12-13 16:39 UTC, Salvatore Filippone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Salvatore Filippone 2006-12-13 16:38:22 UTC
The attached sample code (as usual, much reduced but possibly not yet minimal) produces the subject error. 
[sfilippo@localhost BUGS]$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2-20061212/configure --prefix=/usr/local/gcc42 --with-mpfr=/home/sfilippo/COMPILERS/GFORTRAN/TEMP/mpfr --with-gmp-lib=/home/sfilippo/COMPILERS/GFORTRAN/TEMP/gmp/lib/ --with-gmp=/home/sfilippo/COMPILERS/GFORTRAN/TEMP/gmp
Thread model: posix
gcc version 4.2.0 20061212 (prerelease)
[sfilippo@localhost BUGS]$ gfortran -c test_ab12.f90
test_ab12.f90: In function 'create_scal_p':
test_ab12.f90:66: internal compiler error: in gfc_conv_descriptor_data_addr, at fortran/trans-array.c:186
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Salvatore Filippone 2006-12-13 16:39:07 UTC
Created attachment 12797 [details]
test case
Comment 2 Richard Biener 2006-12-13 17:07:32 UTC
Confirmed.  Fails on trunk as well.
Comment 3 Tobias Burnus 2006-12-13 21:32:38 UTC
ICE is gone, if one removes intent(out).
ICE is at gfc_conv_descriptor_data_addr:
  gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));

program class_scal_p
  implicit none
  type scal_p
    real, allocatable :: b(:)
  end type scal_p
  type(scal_p) :: pd
  call psb_geallv(pd%b)
contains
  subroutine psb_geallv(x)
    real, allocatable, intent(out) :: x(:)
  end subroutine psb_geallv
end program class_scal_p
Comment 4 Paul Thomas 2006-12-20 21:39:12 UTC
This is regtesting right now:

Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c    (revision 120083)
--- gcc/fortran/trans-expr.c    (working copy)
*************** gfc_conv_function_call (gfc_se * se, gfc
*** 2068,2076 ****
                if (fsym && fsym->attr.allocatable
                    && fsym->attr.intent == INTENT_OUT)
                  {
!                 tmp = e->symtree->n.sym->backend_decl;
!                 if (e->symtree->n.sym->attr.dummy)
!                     tmp = build_fold_indirect_ref (tmp);
                    tmp = gfc_trans_dealloc_allocated (tmp);
                    gfc_add_expr_to_block (&se->pre, tmp);
                  }
--- 2068,2074 ----
                if (fsym && fsym->attr.allocatable
                    && fsym->attr.intent == INTENT_OUT)
                  {
!                   tmp = build_fold_indirect_ref (parmse.expr);
                    tmp = gfc_trans_dealloc_allocated (tmp);
                    gfc_add_expr_to_block (&se->pre, tmp);
                  }

Will submit in the morning.

Ciao

Paul
Comment 5 patchapp@dberlin.org 2006-12-21 01:15:38 UTC
Subject: Bug number PR30202

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01473.html
Comment 6 Paul Thomas 2006-12-21 14:00:23 UTC
Subject: Bug 30202

Author: pault
Date: Thu Dec 21 13:59:57 2006
New Revision: 120109

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

	PR fortran/30202
	* trans-array.c (gfc_conv_function_call): Use parmse.expr for
	the nullifying of intent(out) arguments rather than the backend
	declaration.

2006-12-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30202
	* gfortran.dg/alloc_comp_basics_3.f90: New test.



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

Comment 7 Paul Thomas 2006-12-31 15:00:50 UTC
Subject: Bug 30202

Author: pault
Date: Sun Dec 31 15:00:18 2006
New Revision: 120298

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

	BACKPORTS from 4.3

	PR fortran/30202
	* trans-array.c (gfc_conv_function_call): Use parmse.expr for
	the nullifying of intent(out) arguments rather than the backend
	declaration.

	PR fortran/30190
	* trans-array.c (gfc_conv_array_ref): Remove gfc_evaluate_now
	from the -fbounds-check branch.

	PR fortran/29992
	* interface.c (check_sym_interfaces): Module procedures in a
	generic must be use associated or contained in the module.
	* decl.c (gfc_match_modproc): Set attribute mod_proc.
	* gfortran.h (symbol_attribute): Add mod_proc atribute.

	PR fortran/30081
	* resolve.c (resolve_generic_f, resolve_generic_s): Use
	gfc_intrinsic_name to find out if the function is intrinsic
	because it does not have to be a generic intrinsic to be
	overloaded.

	PR fortran/30236
	* interface.c (compare_interfaces): Handle NULL symbols.
	(count_types_test): Count NULL symbols, which correspond to
	alternate returns.

	(check_interface1): Change final argument from int to bool
	in the function and all references.

2006-12-31  Paul Thomas <pault@gcc.gnu.org>

	BACKPORTS from 4.3

	PR fortran/30202
	* gfortran.dg/alloc_comp_basics_3.f90: New test.

	PR fortran/30190
	* gfortran.dg/bounds_check_5.f90: New test.

	PR fortran/29992
	* gfortran.dg/generic_9.f90: New test.

	PR fortran/30081
	* gfortran.dg/generic_10.f90: New test.

	PR fortran/30236
	* gfortran.dg/altreturn_3.f90: New test.

	* gfortran.dg/char_result_12.f90: Fix comment typos.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/alloc_comp_basics_3.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/bounds_check_5.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_10.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_9.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/decl.c
    branches/gcc-4_2-branch/gcc/fortran/gfortran.h
    branches/gcc-4_2-branch/gcc/fortran/interface.c
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/fortran/trans-array.c
    branches/gcc-4_2-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 8 Paul Thomas 2006-12-31 15:19:04 UTC
Fixed on trunk and 4.2

Paul