xref: /llvm-project/flang/test/Semantics/breaking01.f90 (revision 7871deb8213c2162e6234537f334ff6b11257b23)
1! RUN: %flang_fc1 -fsyntax-only -pedantic %s  2>&1 | FileCheck %s --allow-empty
2! Verify portability warning on usage that trips over a F202X breaking change
3program main
4  character(:), allocatable :: str
5  real, allocatable :: x
6  allocate(character(10)::str)
7!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for Internal file
8  write(str, 1) 3.14159
91 format(F6.4)
10  print 2, str
112 format('>',a,'<')
12!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for IOMSG=
13  open(1,file="/dev/nonexistent",status="old",iomsg=str)
14!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for ENCODING
15  inquire(6,encoding=str)
16!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for ERRMSG=
17  allocate(x,errmsg=str)
18!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for ERRMSG=
19  deallocate(x,errmsg=str)
20!CHECK: portability: The deferred length allocatable character scalar variable 'str' may be reallocated to a different length under the new Fortran 202X standard semantics for dummy argument 'cmdmsg='
21  call execute_command_line("true", cmdmsg=str)
22end
23