/* Apply the standard by 'hand' otherwise it gets cleared for
initializers. */
- if (check_len != -1 && slen != check_len
- && !(gfc_option.allow_std & GFC_STD_GNU))
- gfc_error_now ("The CHARACTER elements of the array constructor "
- "at %L must have the same length (%ld/%ld)",
- &expr->where, (long) slen,
- (long) check_len);
+ if (check_len != -1 && slen != check_len)
+ {
+ if (!(gfc_option.allow_std & GFC_STD_GNU))
+ gfc_error_now ("The CHARACTER elements of the array constructor "
+ "at %L must have the same length (%ld/%ld)",
+ &expr->where, (long) slen,
+ (long) check_len);
+ else
+ gfc_notify_std (GFC_STD_LEGACY,
+ "The CHARACTER elements of the array constructor "
+ "at %L must have the same length (%ld/%ld)",
+ &expr->where, (long) slen,
+ (long) check_len);
+ }
s[len] = '\0';
free (expr->value.character.string);
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-std=gnu" }
+!
+! PR fortran/93289
+!
+! Contributed by Tobias Burnus
+
+character(len=*), parameter :: str = "abj", str2 = "1234"
+print *, [character(5) :: str, "ab", "hjf333"]
+print *, [character(5) :: str, str2]
+print *, [str, "ab", "hjf333"] ! { dg-warning "must have the same length" }
+print *, [str, str2] ! { dg-warning "must have the same length" }
+end
call foo([a(8),a(9)], res)\r
if (trim (res) .ne. "type(a) array 8 9") STOP 1
\r
- call foo([sun, " & rain"], res)\r
+ call foo([sun, " & rain "], res)
if (trim (res) .ne. "char( 8, 2)sunshine & rain") STOP 1
\r
call foo([sun//" never happens", " & rain always happens"], res)\r