https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61907

--- Comment #3 from Vittorio Zecca <zeccav at gmail dot com> ---
Same behaviour in 4.9.2 in trans-array.c line 2206

typespec_chararray_ctor = (expr->ts.u.cl &&
expr->ts.u.cl->length_from_typespec);

It seems length_from_typespec is wrong,
OR the sanitizer -fsanitize=undefined is wrong.

Trying the following:
! taken from pr43808.f90
  type :: a
    integer, allocatable :: i(:)
  end type a
  type :: b
    type (a), allocatable :: j(:)
  end type b
  type(a) :: x(1)
  type(b) :: y(1)
  y(1) = b((/x(1)/))
end

I get 
/home/vitti/gcc-4.9.2-sanitize/test/f951 p.f90
 MAIN__../../gcc-4.9.2/gcc/fortran/trans-array.c:2206:44: runtime error: load
of value 172, which is not a valid value for type 'bool'
 main
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <*free_inline_summary>
<whole-program> <inline>Assembling functions:
 MAIN__ main

Reply via email to