Bug report gcc 4.8

W Spector w6ws@earthlink.net
Mon Jun 9 15:43:00 GMT 2014


Unfortunately Dr Browns recent thread got off on a wrong track, but the 
problem remains.  I am still not convinced that this ICE requires a 
change to the array descriptors.

Here is a slightly changed version of his test case.  I introduced a 
temporary pointer called temp_p.  Then split his pointer assignment into 
two pointer assignments - using temp_p between them.

Either of the two pointer assignments compiles fine.  However together, 
they fail.  While the first pointer assignment could potentially have a 
stride, the second should be a simple copy of the descriptor from one 
pointer to the other.

I should add that the compiler traceback for this case is different than 
the traceback from the code in comment #5 of PR 34640.  In this case, 
the ICE comes from line 1473 of trans-decl.c.  In PR 34640, the ICE 
comes from line 6715 of trans-expr.c.

So it seems to me like a different bug than PR 34640.

Walter

program test_pointers
   implicit none

   integer :: i, ndata

   ! Note that we make an array of the user defined type,
   ! not the data component

   type data_t
      real :: x
   end type data_t

   type(data_t), allocatable, target :: data(:)

   ! Now define a type containing an 'embedded' data pointer

   type data_pointer_t
      real, pointer :: p_x(:)
   end type data_pointer_t
   type(data_pointer_t) :: data_pointer

   real, pointer :: temp_p(:)

   ndata = 10
   allocate(data(ndata))

   forall(i=1:ndata) data(i)%x = float(i)

! Point to the data using the 'embedded' pointer

#if !defined (ORIGINAL)
! ICE when both lines are compiled.  Compiles OK when either line is
! commented out.
   temp_p => data%x           ! Potential strided access
   data_pointer%p_x => temp_p ! Should be a simple copy of the descriptor
#else
! Gregs original code
   data_pointer%p_x => data%x  ! ICE happens here with gfortran
#endif

   write(*,*) data_pointer%p_x

end program test_pointers

wws@w6ws-4:~/fortran/gcb$ /usr/local/gcc-trunk/bin/gfortran --version
GNU Fortran (GCC) 4.10.0 20140524 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

wws@w6ws-4:~/fortran/gcb$ /usr/local/gcc-trunk/bin/gfortran 
test_pointers.F90
test_pointers.F90: In function ‘test_pointers’:
test_pointers.F90:1:0: internal compiler error: Segmentation fault
  program test_pointers
  ^
0xa36fbf crash_signal
	../../gcc-trunk/gcc/toplev.c:337
0x626bdb gfc_get_symbol_decl(gfc_symbol*)
	../../gcc-trunk/gcc/fortran/trans-decl.c:1473
0x62999f generate_local_decl
	../../gcc-trunk/gcc/fortran/trans-decl.c:4845
0x5e9ef3 do_traverse_symtree
	../../gcc-trunk/gcc/fortran/symbol.c:3576
0x62a7ba generate_local_vars
	../../gcc-trunk/gcc/fortran/trans-decl.c:5017
0x62a7ba gfc_generate_function_code(gfc_namespace*)
	../../gcc-trunk/gcc/fortran/trans-decl.c:5537
0x5be2e8 translate_all_program_units
	../../gcc-trunk/gcc/fortran/parse.c:4601
0x5be2e8 gfc_parse_file()
	../../gcc-trunk/gcc/fortran/parse.c:4798
0x5fbc05 gfc_be_parse_file
	../../gcc-trunk/gcc/fortran/f95-lang.c:188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
wws@w6ws-4:~/fortran/gcb$
wws@w6ws-4:~/fortran/gcb$ gfortran pr34640.f90
pr34640.f90: In function ‘get_values’:
pr34640.f90:11:0: internal compiler error: Segmentation fault
      values => d(:)%value
  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
wws@w6ws-4:~/fortran/gcb$

File pr34640 is the code from comment #5 in PR34640

wws@w6ws-4:~/fortran/gcb$ /usr/local/gcc-trunk/bin/gfortran pr34640.f90
pr34640.f90: In function ‘get_values’:
pr34640.f90:11:0: internal compiler error: Segmentation fault
      values => d(:)%value
  ^
0xa36fbf crash_signal
	../../gcc-trunk/gcc/toplev.c:337
0x63e330 gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*)
	../../gcc-trunk/gcc/fortran/trans-expr.c:6715
0x60095a trans_code
	../../gcc-trunk/gcc/fortran/trans.c:1656
0x62aa8e gfc_generate_function_code(gfc_namespace*)
	../../gcc-trunk/gcc/fortran/trans-decl.c:5595
0x6021b1 gfc_generate_module_code(gfc_namespace*)
	../../gcc-trunk/gcc/fortran/trans.c:1978
0x5be001 translate_all_program_units
	../../gcc-trunk/gcc/fortran/parse.c:4588
0x5be001 gfc_parse_file()
	../../gcc-trunk/gcc/fortran/parse.c:4798
0x5fbc05 gfc_be_parse_file
	../../gcc-trunk/gcc/fortran/f95-lang.c:188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
wws@w6ws-4:~/fortran/gcb$



More information about the Fortran mailing list