[all-commits] [llvm/llvm-project] 68f4e4: [flang] Adjust "doubled operator" expression exten...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Mon Jun 3 11:58:39 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 68f4e46c432ea2f1f8d33c6dc9345f6e2afeec4a
https://github.com/llvm/llvm-project/commit/68f4e46c432ea2f1f8d33c6dc9345f6e2afeec4a
Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
Date: 2024-06-03 (Mon, 03 Jun 2024)
Changed paths:
M flang/docs/Extensions.md
M flang/include/flang/Common/Fortran-features.h
M flang/lib/Parser/expr-parsers.cpp
A flang/test/Evaluate/signed-mult-opd.f90
Log Message:
-----------
[flang] Adjust "doubled operator" expression extension (#93353)
Most Fortran compilers accept "doubled operators" as a language
extension. This is the use of a unary '+' or '-' operator that is not
the first unparenthesized operator in an expression, as in 'x*-y'.
This compiler has implemented this extension, but in a way that's
different from other compilers' behavior. I interpreted the unary
'+'/'-' as a unary operator in the sense of C/C++, giving it a higher
priority than any binary (dyadic) operator.
All other compilers with this extension, however, give a unary '+'/'-' a
lower precedence than exponentiation ('**'), a binary operator that
C/C++ lacks. And this interpretation makes more sense for Fortran,
anyway, where the standard conforming '-x**y' must mean '-(x**y)'
already.
This patch makes 'x*-y**z' parse as 'x*-(y**z)', not 'x*(-y)**z)', and
adds a test to ensure that it does.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list