Re: [PATCH] D28467: [Sema] Add warning for unused lambda captures

2017-01-19 Thread Malcolm Parsons via cfe-commits
On 19 January 2017 at 03:47, Aaron Ballman  wrote:
> It is not used in an unevaluated context -- that is a bug.

It is an evaluated expression, but is it odr-used?

C++14 [basic.def.odr] p3:

A variable x whose name appears as a potentially-evaluated expression
ex is odr-used by ex unless applying the lvalue-to-rvalue conversion
(4.1) to x yields a constant expression (5.20) that does not invoke
any nontrivial functions and, if x is an object, ex is an element of
the set of potential results of an expression e, where either the
lvalue-to-rvalue conversion (4.1) is applied to e, or e is a
discarded-value expression (Clause 5). ...

5.20 [expr.const] p3:

An integral constant expression is an expression of integral or
unscoped enumeration type, implicitly converted to a prvalue, where
the converted expression is a core constant expression. [ Note: Such
expressions may be used as array bounds (8.3.4, 5.3.4), as bit-field
lengths (9.6), as enumerator initializers if the underlying type is
not fixed (7.2), and as alignments (7.6.2). — end note ]

I read that as kDelta is not odr-used.

GCC and ICC don't require kDelta to be captured either.

-- 
Malcolm Parsons
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28862: [compiler-rt] [test] Use approximate comparison on float types

2017-01-19 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Just to be clear, the values also differ per -O0 vs -O2. I'm not sure if we can 
even reliably figure that out.

I've tried to work around the issue by building everything in 387 mode. 
However, in that case muldc3_test has even larger mismatches and didn't really 
want to go figuring that out.


Repository:
  rL LLVM

https://reviews.llvm.org/D28862



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28849: [compiler-rt] [test] Fix page address logic in clear_cache_test

2017-01-19 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 84947.
mgorny retitled this revision from "[compiler-rt] [test] Fix page address logic 
in clear_cache_test to use binary negation" to "[compiler-rt] [test] Fix page 
address logic in clear_cache_test".
mgorny edited the summary of this revision.
mgorny added a comment.

Updated to use page size logic on POSIX and Windows systems. I haven't tested 
the latter, though.


https://reviews.llvm.org/D28849

Files:
  test/builtins/Unit/clear_cache_test.c


Index: test/builtins/Unit/clear_cache_test.c
===
--- test/builtins/Unit/clear_cache_test.c
+++ test/builtins/Unit/clear_cache_test.c
@@ -18,9 +18,20 @@
 if (!FlushInstructionCache(GetCurrentProcess(), start, end-start))
 exit(1);
 }
+
+static uintptr_t get_page_size() {
+SYSTEM_INFO si;
+GetSystemInfo();
+return si.dwPageSize;
+}
 #else
+#include 
 #include 
 extern void __clear_cache(void* start, void* end);
+
+static uintptr_t get_page_size() {
+return sysconf(_SC_PAGE_SIZE);
+}
 #endif
 
 
@@ -56,8 +67,8 @@
 int main()
 {
 // make executable the page containing execution_buffer 
-char* start = (char*)((uintptr_t)execution_buffer & (-4095));
-char* end = (char*)((uintptr_t)(_buffer[128+4096]) & (-4095));
+char* start = (char*)((uintptr_t)execution_buffer & (-get_page_size()));
+char* end = (char*)((uintptr_t)(_buffer[128+4096]) & 
(-get_page_size()));
 #if defined(_WIN32)
 DWORD dummy_oldProt;
 MEMORY_BASIC_INFORMATION b;


Index: test/builtins/Unit/clear_cache_test.c
===
--- test/builtins/Unit/clear_cache_test.c
+++ test/builtins/Unit/clear_cache_test.c
@@ -18,9 +18,20 @@
 if (!FlushInstructionCache(GetCurrentProcess(), start, end-start))
 exit(1);
 }
+
+static uintptr_t get_page_size() {
+SYSTEM_INFO si;
+GetSystemInfo();
+return si.dwPageSize;
+}
 #else
+#include 
 #include 
 extern void __clear_cache(void* start, void* end);
+
+static uintptr_t get_page_size() {
+return sysconf(_SC_PAGE_SIZE);
+}
 #endif
 
 
@@ -56,8 +67,8 @@
 int main()
 {
 // make executable the page containing execution_buffer 
-char* start = (char*)((uintptr_t)execution_buffer & (-4095));
-char* end = (char*)((uintptr_t)(_buffer[128+4096]) & (-4095));
+char* start = (char*)((uintptr_t)execution_buffer & (-get_page_size()));
+char* end = (char*)((uintptr_t)(_buffer[128+4096]) & (-get_page_size()));
 #if defined(_WIN32)
 DWORD dummy_oldProt;
 MEMORY_BASIC_INFORMATION b;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


<    1   2