Files
clang-p2996/flang/test/Semantics/altreturn02.f90
Emil Kieri 1dd8da2d7c [flang] Fix semantics check for RETURN statement
The RETURN statement is allowed in functions and subroutines, but not
in main programs. It is however a common extension, which we also
implement, to allow RETURN from main programs -- we only issue a
portability warning when -pedantic or -std=f2018 are set.

This patch fixes false positives for this portability warning, where it
was triggered also when RETURN was present in functions or subroutines.

Fixexs #55080

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D124732
2022-05-02 22:04:58 +02:00

11 lines
284 B
Fortran

! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s --allow-empty
! Check subroutine with alt return
SUBROUTINE TEST (N, *, *)
IF ( N .EQ. 0 ) RETURN
IF ( N .EQ. 1 ) RETURN 1
RETURN 2
END
! CHECK-NOT: error:
! CHECK-NOT: portability: