aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorFritz Reese <fritzoreese@gmail.com>2016-10-25 15:30:51 +0000
committerFritz Reese <foreese@gcc.gnu.org>2016-10-25 15:30:51 +0000
commit1cf1719bc07ade2e96d47c7bae00d1203c847ee0 (patch)
tree4168fa510d949da5efd576836059e0d1cea0bb96 /gcc/fortran
parentcd714e1e56c53aeda0fe365a1daebf217731b42a (diff)
downloadgcc-1cf1719bc07ade2e96d47c7bae00d1203c847ee0.zip
gcc-1cf1719bc07ade2e96d47c7bae00d1203c847ee0.tar.gz
gcc-1cf1719bc07ade2e96d47c7bae00d1203c847ee0.tar.bz2
Enable .XOR. operator with -std=legacy.
gcc/fortran/ * match.c (gfc_match_intrinsic_op): Match ".XOR." with -std=legacy. * gfortran.texi: Document. gcc/testsuite/gfortran.dg/ * dec_logical_xor_1.f90: New. * dec_logical_xor_2.f90: New. * dec_logical_xor_3.f03: New. From-SVN: r241520
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/gfortran.texi10
-rw-r--r--gcc/fortran/match.c13
3 files changed, 29 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 9bd1d80..c6a07e9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,7 +1,12 @@
2016-10-25 Fritz Reese <fritzoreese@gmail.com>
- * primary.c (gfc_match_rvalue): Match %LOC as LOC with -std=legacy.
- * gfortran.texi: Document.
+ * match.c (gfc_match_intrinsic_op): Match ".XOR." with -std=legacy.
+ * gfortran.texi: Document.
+
+2016-10-25 Fritz Reese <fritzoreese@gmail.com>
+
+ * primary.c (gfc_match_rvalue): Match %LOC as LOC with -std=legacy.
+ * gfortran.texi: Document.
2016-10-25 Fritz Reese <fritzoreese@gmail.com>
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index e1256bd..60b619f 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1468,6 +1468,7 @@ compatibility extensions along with those enabled by @option{-std=legacy}.
* Form feed as whitespace::
* TYPE as an alias for PRINT::
* %LOC as an rvalue::
+* .XOR. operator::
@end menu
@node Old-style kind specifications
@@ -2558,6 +2559,14 @@ integer :: i
call sub(%loc(i))
@end smallexample
+@node .XOR. operator
+@subsection .XOR. operator
+@cindex operators, xor
+
+GNU Fortran supports @code{.XOR.} as a logical operator with @code{-std=legacy}
+for compatibility with legacy code. @code{.XOR.} is equivalent to
+@code{.NEQV.}. That is, the output is true if and only if the inputs differ.
+
@node Extensions not implemented in GNU Fortran
@section Extensions not implemented in GNU Fortran
@@ -2582,7 +2591,6 @@ code that uses them running with the GNU Fortran compiler.
* Variable FORMAT expressions::
@c * Q edit descriptor::
@c * TYPE and ACCEPT I/O Statements::
-@c * .XOR. operator::
@c * CARRIAGECONTROL, DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::
@c * Omitted arguments in procedure call::
* Alternate complex function syntax::
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 236231e..94aa830 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -960,6 +960,19 @@ gfc_match_intrinsic_op (gfc_intrinsic_op *result)
}
break;
+ case 'x':
+ if (gfc_next_ascii_char () == 'o'
+ && gfc_next_ascii_char () == 'r'
+ && gfc_next_ascii_char () == '.')
+ {
+ if (!gfc_notify_std (GFC_STD_LEGACY, ".XOR. operator at %C"))
+ return MATCH_ERROR;
+ /* Matched ".xor." - equivalent to ".neqv.". */
+ *result = INTRINSIC_NEQV;
+ return MATCH_YES;
+ }
+ break;
+
default:
break;
}