ebevhan updated this revision to Diff 255979.
ebevhan added a comment.
Rebased.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73189/new/
https://reviews.llvm.org/D73189
Files:
clang/lib/AST/ExprConstant.cpp
clang/test/Frontend/fixed_point_crash.c
Index: clang/test/Frontend/fixed_point_crash.c
===================================================================
--- /dev/null
+++ clang/test/Frontend/fixed_point_crash.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify -ffixed-point %s
+
+union a {
+ _Accum x;
+ int i;
+};
+
+int fn1() {
+ union a m;
+ m.x = 5.6k;
+ return m.i;
+}
+
+int fn2() {
+ union a m;
+ m.x = 7, 5.6k; // expected-warning {{expression result unused}}
+ return m.x, m.i; // expected-warning {{expression result unused}}
+}
+
+_Accum acc = (0.5r, 6.9k); // expected-warning {{expression result unused}}
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -12695,6 +12695,9 @@
}
bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
+ if (E->isPtrMemOp() || E->isAssignmentOp() || E->getOpcode() == BO_Comma)
+ return ExprEvaluatorBaseTy::VisitBinaryOperator(E);
+
const Expr *LHS = E->getLHS();
const Expr *RHS = E->getRHS();
FixedPointSemantics ResultFXSema =
Index: clang/test/Frontend/fixed_point_crash.c
===================================================================
--- /dev/null
+++ clang/test/Frontend/fixed_point_crash.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify -ffixed-point %s
+
+union a {
+ _Accum x;
+ int i;
+};
+
+int fn1() {
+ union a m;
+ m.x = 5.6k;
+ return m.i;
+}
+
+int fn2() {
+ union a m;
+ m.x = 7, 5.6k; // expected-warning {{expression result unused}}
+ return m.x, m.i; // expected-warning {{expression result unused}}
+}
+
+_Accum acc = (0.5r, 6.9k); // expected-warning {{expression result unused}}
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -12695,6 +12695,9 @@
}
bool FixedPointExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
+ if (E->isPtrMemOp() || E->isAssignmentOp() || E->getOpcode() == BO_Comma)
+ return ExprEvaluatorBaseTy::VisitBinaryOperator(E);
+
const Expr *LHS = E->getLHS();
const Expr *RHS = E->getRHS();
FixedPointSemantics ResultFXSema =
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits