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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> Compiling the first test in comment 0 gives an error with 4.7 up to trunk
> (4.10)
> 
> Error: Allocating str at (1) with type-spec requires the same
> character-length parameter as in the declaration
> 
> even if i=3 or with the following code
> 
> integer :: i
> i = 3
> call sub(i)
> end
> subroutine sub(i)
>   character(len=i), allocatable :: str
>   allocate (character(len=3) :: str)
> end
> 
> This does not seem correct (unless I am missing something).

This rejects-valid is due to commit r0-114448-g2e0bffaf8cc85c, which
conspires with r0-111166-g13001f33ca6277.

gfc_dep_compare_expr returns when comparing i with 3:

  if (e1->expr_type != e2->expr_type)
    return -3;

which means:

   * -3 if e1 /= e2, but we cannot tell which one is larger.

and which I think is wrong.  (It did return -2 before r0-111166 meaning

   * -2 if the relationship could not be determined

which I think was correct.

Replacing the return value -3 by -2 fixes the rejects-valid, so the only thing
that is missing is the string-length check.

Reply via email to