Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Unified Diff: sandbox/linux/bpf_dsl/bpf_dsl.cc

Issue 1327693005: sandbox/linux/bpf_dsl: eliminate implicit dependency on C++ compiler behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explanatory comment per offline feedback from jln Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/bpf_dsl/bpf_dsl.cc
diff --git a/sandbox/linux/bpf_dsl/bpf_dsl.cc b/sandbox/linux/bpf_dsl/bpf_dsl.cc
index 0363be068e72532092e437f1562f61e239890ad5..3772efb2c703d4756746ff3cdf137a8d7d943177 100644
--- a/sandbox/linux/bpf_dsl/bpf_dsl.cc
+++ b/sandbox/linux/bpf_dsl/bpf_dsl.cc
@@ -118,8 +118,11 @@ class IfThenResultExprImpl : public internal::ResultExprImpl {
: cond_(cond), then_result_(then_result), else_result_(else_result) {}
CodeGen::Node Compile(PolicyCompiler* pc) const override {
- return cond_->Compile(
- pc, then_result_->Compile(pc), else_result_->Compile(pc));
+ // We compile the "then" and "else" expressions in separate statements so
+ // they have a defined sequencing. See https://crbug.com/529480.
+ CodeGen::Node then_node = then_result_->Compile(pc);
+ CodeGen::Node else_node = else_result_->Compile(pc);
+ return cond_->Compile(pc, then_node, else_node);
}
bool HasUnsafeTraps() const override {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698