-
Notifications
You must be signed in to change notification settings - Fork 49
Roll up work on folding, descriptors, runtime, RESHAPE #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -471,7 +472,13 @@ template<int KIND> | |||
auto RealExpr<KIND>::IntPower::FoldScalar(FoldingContext &context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use auto
for these functions? They don't seem to obey the "Don't use auto
functions unless..." rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an outlined member function definition whose result type uses the name of a type declared in the class. Written without auto
, the result type would have to be something like std::optional<typename RealExpr<KIND>::Scalar>
. This is exactly the situation in which the "unless..." exceptional language in the style guide is meant to apply.
lib/evaluate/int-power.h
Outdated
REAL one{REAL::FromInteger(INT{1}).value}; | ||
ValueWithRealFlags<REAL> result; | ||
result.value = one; | ||
if (base.IsNotANumber()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We seem to be using "NaN" everywhere else, so why not "IsNaN" for this function?
(I know this wasn't added in this change -- sorry.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rename some of the others to avoid the needless use of an obscure term of art.
runtime/descriptor.cc
Outdated
extent) == CFI_SUCCESS); | ||
raw_.f18Addendum = addendum; | ||
if (addendum) { | ||
new (Addendum()) DescriptorAddendum{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any of these placement news fail because the expression is nullptr, does that mean there is a bug in the logic of Descriptor? If it could be due to an error in how the client of this class is using it, I think an explicit assertion would be helpful. Otherwise, this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, Addendum must be non-null, but it can be made more explicitly so.
case 8: raw_ = CFI_type_int64_t; break; | ||
} | ||
break; | ||
case TypeCategory::Derived: raw_ = CFI_type_struct; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang will warn about missing default cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't.
test/evaluate/real.cc
Outdated
{0x40000000, "0x1.0p1"}, {0x3f000000, "0x1.0p-1"}, | ||
{0x7f7fffff, "0x1.fffffep127"}, {0x00800000, "0x1.0p-126"}, | ||
{0x00400000, "0x0.8p-127"}, {0x00000001, "0x0.000002p-127"}, | ||
{0, nullptr}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this project use clang-format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unfortunately it sometimes makes a mess of the code.
In this case, adding a comma after {0, nullptr}
would get it back the way it was. I think that would be an improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Original-commit: flang-compiler/f18@2dc2c2a Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@6f1ef45 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@90e5563 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@77ed88d Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@5adc208 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@5e68ebe Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@b4423e3 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@0ab1704 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@7863350 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
…gory. Original-commit: flang-compiler/f18@5012e65 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@f583987 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
…d with GNU 8.2.0. Original-commit: flang-compiler/f18@80257ee Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@c20ce35 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@0c946be Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@34eac17 Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@720e71c Reviewed-on: flang-compiler/f18#162 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@a98942e Reviewed-on: flang-compiler/f18#162
Some disconnected changes here related to evaluation and execution. The C++ interface to the ISO standard descriptor is now is much better shape, and can serve to implement a working RESHAPE intrinsic. More to come, but it was past time to checkpoint and merge this work area.
As a readability improvement (I think), I've replaced many instances of
return {};
withreturn std::nullopt;
in contexts where the function's type is an instantiation ofstd::optional<>
.Also, a GNU C++ compiler bug workaround in
lib/parser/basic-parsers.h
is no longer needed with GNU 8.2.0, and the conditional compilation tests were adjusted accordingly.