Don't use std::initializer_list for array views.
The team debated whether this was legal or not at the time.
It seems that at least one of Android's compilers generates code that stomps the list data after the `std::initializer_list` is declared and before it is used.
Switch to using regular C arrays with constexpr / std::array.
Fixes: b/149235682
Change-Id: Ief95dc4c6b4aee0c181bbe34aff19aa95f5fac8c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41051
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index 4624064..7efeb5b 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -45,6 +45,7 @@
# include <Windows.h>
#endif
+#include <array>
#include <iostream>
#include <limits>
#include <mutex>
@@ -159,7 +160,7 @@
ret = function->makeVariable(retTy);
}
- std::initializer_list<Ice::Variable *> iceArgs = { std::forward<RArgs>(args)... };
+ std::array<Ice::Variable *, sizeof...(args)> iceArgs {{ std::forward<RArgs>(args)... }};
auto call = Ice::InstCall::create(function, iceArgs.size(), ret, getConstantPointer(function->getContext(), reinterpret_cast<void const *>(fptr)), false);
for(auto arg : iceArgs)