summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Parser/call.f951
-rw-r--r--test/Parser/expressions.f951
-rw-r--r--test/Parser/implicitFunctions.f9517
-rw-r--r--test/Sema/call.f959
-rw-r--r--test/Sema/implicitDefault.f951
-rw-r--r--test/Sema/variables.f952
6 files changed, 28 insertions, 3 deletions
diff --git a/test/Parser/call.f95 b/test/Parser/call.f95
index f770d383f7..e20ea447ab 100644
--- a/test/Parser/call.f95
+++ b/test/Parser/call.f95
@@ -8,7 +8,6 @@ PROGRAM test
CALL SUB()
CALL FUNC(1,2)
- CALL void ! expected-error {{expected a function after 'CALL'}}
CALL 22 ! expected-error {{expected identifier}}
CALL FUNC(1,2 ! expected-error {{expected ')'}}
diff --git a/test/Parser/expressions.f95 b/test/Parser/expressions.f95
index 1573ff7dca..476dd43414 100644
--- a/test/Parser/expressions.f95
+++ b/test/Parser/expressions.f95
@@ -32,5 +32,4 @@ PROGRAM expressions
x = ! expected-error {{expected an expression after '='}}
- x = A ! expected-error {{use of undeclared identifier 'a'}}
ENDPROGRAM expressions
diff --git a/test/Parser/implicitFunctions.f95 b/test/Parser/implicitFunctions.f95
new file mode 100644
index 0000000000..632c82a3af
--- /dev/null
+++ b/test/Parser/implicitFunctions.f95
@@ -0,0 +1,17 @@
+! RUN: %flang -fsyntax-only -verify < %s
+! RUN: %flang -fsyntax-only -verify -ast-print %s 2>&1 | %file_check %s
+
+PROGRAM imptest
+ integer i
+ real func
+ real func2
+ real func3(10)
+
+ i = 0
+ func2 = 1
+ i = abs(i) ! CHECK: i = abs(i)
+ i = foo(i) ! CHECK: i = int(foo(i))
+ i = func(i)! CHECK: i = int(func(i))
+ i = func3(i) ! CHECK: i = int(func3(i))
+ i = func2(i) ! expected-error {{unexpected '('}}
+END
diff --git a/test/Sema/call.f95 b/test/Sema/call.f95
index c97898d784..6d752d274a 100644
--- a/test/Sema/call.f95
+++ b/test/Sema/call.f95
@@ -3,12 +3,21 @@
SUBROUTINE SUB(I,J)
END
+REAL FUNCTION FOO()
+ Foo = 1
+END
+
PROGRAM test
EXTERNAL FUNC
+ INTEGER NOFUNC
CALL SUB(1,2)
CALL SUB ! expected-error {{too few arguments to subroutine call, expected 2, have 0}}
CALL SUB(1) ! expected-error {{too few arguments to subroutine call, expected 2, have 1}}
CALL SUB(1,2,3,4) ! expected-error {{too many arguments to subroutine call, expected 2, have 4}}
CALL FUNC
+ CALL IMPFUNC(1,2)
+
+ CALL NOFUNC ! expected-error {{statement requires a subroutine reference (variable 'nofunc' invalid)}}
+ CALL FOO ! expected-error {{statement requires a subroutine reference (function 'foo' invalid)}}
END
diff --git a/test/Sema/implicitDefault.f95 b/test/Sema/implicitDefault.f95
index b32c034e65..5e99bc7bca 100644
--- a/test/Sema/implicitDefault.f95
+++ b/test/Sema/implicitDefault.f95
@@ -14,4 +14,5 @@ PROGRAM imptest
R = 33.25 ! CHECK: r = 33.25
Z = 1 ! CHECK: z = real(1)
a = -11.23
+ x = y ! CHECK: x = y
END PROGRAM imptest
diff --git a/test/Sema/variables.f95 b/test/Sema/variables.f95
index 6631ee1b3a..d07784e408 100644
--- a/test/Sema/variables.f95
+++ b/test/Sema/variables.f95
@@ -13,6 +13,6 @@ PROGRAM vartest
REAL :: Y ! expected-error {{redefinition of 'y'}}
- i = K ! expected-error {{use of undeclared identifier 'k'}}
+ i = K
END PROGRAM