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

Harald Anlauf <anlauf at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gmx dot de

--- Comment #5 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Gerhard Steinmetz from comment #3)
> Another situation :
> 
> $ cat z4.f90
> program p
>    character(3) :: a(2) = ['abc', 'xyz']
>    character(3) :: b(1,2) = ' '
>    equivalence (b, a)
> end
> 
> $ gfortran-6 z4.f90
> internal compiler error: in gfc_encode_character, at
> fortran/target-memory.c:227
> 
> ---
> 
> Interestingly, this works without initializer of b :

It is not important that b is of rank 2, the ICE occurs also for

   character(3) :: b(2) = ' '

Running under the debugger, the assert

220     gfc_encode_character (int kind, size_t length, const gfc_char_t
*string,
221                           unsigned char *buffer, size_t buffer_size)
222     {
223       size_t elsize = size_character (1, kind);
224       tree type = gfc_get_char_type (kind);
225
226       gcc_assert (buffer_size >= size_character (length, kind));

appears to be triggered by a call with buffer_size=0 while processing the
equivalence.  This can also be guessed by looking at the backtrace.

Reply via email to