[Bug fortran/31219] ICE on valid code with gfortran

2007-03-16 Thread fxcoudert at gcc dot gnu dot org


--- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:23 
---
Reduced testcase:

$ cat a.f90
  call gee( [f(1)] )
contains
 function f(k) result(i)
  integer :: k
  character(len=k) :: i
 end function
end
$ ./bin/gfortran a.f90
a.f90:1: internal compiler error: Segmentation fault


The backtrace is:

Program received signal SIGSEGV, Segmentation fault.
get_frame_type (info=0x0) at /utmp/coudert/gfortran/trunk/gcc/tree-nested.c:199
199   tree type = info-frame_type;
(gdb) where
#0  get_frame_type (info=0x0)
at /utmp/coudert/gfortran/trunk/gcc/tree-nested.c:199
#1  0x006b8a04 in get_chain_decl (info=0xdcc3f0)
at /utmp/coudert/gfortran/trunk/gcc/tree-nested.c:305
#2  0x006b9af4 in get_nonlocal_debug_decl (info=0xdcc3f0, 
decl=0x2a984ca000) at /utmp/coudert/gfortran/trunk/gcc/tree-nested.c:852
#3  0x006bc1d3 in convert_nonlocal_reference (tp=0x2a984cecb0, 
walk_subtrees=0x7fbfffea7c, data=Variable data is not available.
)
at /utmp/coudert/gfortran/trunk/gcc/tree-nested.c:923
#4  0x007b076b in walk_tree (tp=0x2a984cecb0, 
func=0x6bc100 convert_nonlocal_reference, data=0x7fbfffec90, pset=0x0)
at /utmp/coudert/gfortran/trunk/gcc/tree.c:8000
#5  0x007b087f in walk_tree (tp=0x2a984cd448, 
func=0x6bc100 convert_nonlocal_reference, data=0x7fbfffec90, pset=0x0)
at /utmp/coudert/gfortran/trunk/gcc/tree.c:8235


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||ice-on-valid-code
  Known to fail||4.1.3 4.2.0 4.3.0
   Last reconfirmed|-00-00 00:00:00 |2007-03-16 15:23:52
   date||


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



[Bug fortran/31219] ICE on valid code with gfortran

2007-03-16 Thread fxcoudert at gcc dot gnu dot org


--- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:25 
---
Forgot to say: the original tree dump is

f (__result, .__result, k)
{
  (void) 0;


MAIN__ ()
{
  static void f (char[1:] , int4, int4 );

  _gfortran_set_std (68, 127, 0);
  {
void * D.1377;
void * D.1374;
struct array1_unknown atmp.3;
void * D.1367;
struct array1_unknown atmp.0;

atmp.0.dtype = (SAVE_EXPR (unnamed type) (..__result + -1) + 1  6) +
49;
atmp.0.dim[0].stride = 1;
atmp.0.dim[0].lbound = 0;
atmp.0.dim[0].ubound = 0;
D.1367 = _gfortran_internal_malloc64 ((int8) (SAVE_EXPR (unnamed type)
(..__result + -1) + 1));
atmp.0.data = D.1367;
atmp.0.offset = 0;
{
  char[1:D.1371] * pstr.2;
  int4 D.1371;
  int4 * D.1370;
  static int4 C.1369 = 1;

  D.1370 = C.1369;
  D.1371 = *D.1370;
  pstr.2 = (char[1:D.1371] *) _gfortran_internal_malloc (D.1371);
  f (pstr.2, D.1371, D.1370);
  __builtin_memcpy ((*(char[0:][1:..__result] *) atmp.0.data)[0], pstr.2,
D.1371);
  _gfortran_internal_free ((void *) pstr.2);
}
atmp.3.dtype = (SAVE_EXPR (unnamed type) (..__result + -1) + 1  6) +
49;
atmp.3.dim[0].stride = 1;
atmp.3.dim[0].lbound = 0;
atmp.3.dim[0].ubound = 0;
D.1374 = _gfortran_internal_malloc64 ((int8) (SAVE_EXPR (unnamed type)
(..__result + -1) + 1));
atmp.3.data = D.1374;
atmp.3.offset = 0;
{
  int8 S.4;

  S.4 = 0;
  while (1)
{
  if (S.4  0) goto L.1;
  (*(char[0:][1:..__result] *) atmp.3.data)[S.4] =
(*(char[0:][1:..__result] *) atmp.0.data)[S.4];
  S.4 = S.4 + 1;
}
  L.1:;
}
D.1377 = _gfortran_internal_pack (atmp.3);
gee (D.1377, ..__result);
if (D.1377 != (char[0:][1:..__result] *) atmp.3.data)
  {
_gfortran_internal_unpack (atmp.3, D.1377);
_gfortran_internal_free (D.1377);
  }
_gfortran_internal_free (atmp.0.data);
_gfortran_internal_free (atmp.3.data);
  }
}


-- 


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