diff mbox series

[RFC] Merge libsanitizer from upstream

Message ID 20171016185250.GX14653@tucnak
State New
Headers show
Series [RFC] Merge libsanitizer from upstream | expand

Commit Message

Jakub Jelinek Oct. 16, 2017, 6:52 p.m. UTC
Hi!

The following patch is an attempt at libsanitizer merge from upstream.
Sadly libubsan has several ABI incompatible changes, dunno if we should
fight the mess and re-add backward compatibility back, or as the patch
does just bump soname, upstream clearly doesn't care about ABI compatibility
at all.

Bootstrapped/regtested on x86_64-linux and i686-linux, it would be nice to
get it tested on other targets (e.g. darwin, that breaks almost all the time
when doing merges, but no access to that).

Included is just the non-libsanitizer/ part plus GCC owned file changes
in libsanitizer (except regenerated ones), attached is bzip2ed full patch.

Thoughts on this?

2017-10-16  Jakub Jelinek  <jakub@redhat.com>

	* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
	builtins, store max (log2 (align), 0) into uchar field instead of
	align into uptr field.
	(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
	store uchar 0 field instead of uptr 0 field.
	(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
	instead of passing one address of struct with 2 locations pass
	two addresses of structs with 1 location each.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
	BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
	(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
	BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.

	* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
	from expected output regexps.
	* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
	* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
	* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
	* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.

	* All source files: Merge from upstream 315899.
        * asan/Makefile.am (nodist_saninclude_HEADERS): Add
	include/sanitizer/tsan_interface.h.
        * asan/libtool-version: Bump the libasan SONAME.
	* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
	(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
        * sanitizer_common/Makefile.am (sanitizer_common_files): Add
	sancov_flags.cc, sanitizer_allocator_checks.cc,
	sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
	sanitizer_file.cc, sanitizer_mac_libcdep.cc and
	sanitizer_stoptheworld_mac.cc.  Remove sanitizer_coverage_libcdep.cc
	and sanitizer_coverage_mapping_libcdep.cc.
        * tsan/Makefile.am (tsan_files): Add tsan_external.cc.
	* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
	(ubsan_files): Add ubsan_init_standalone.cc and
	ubsan_signals_standalone.cc.
	* ubsan/libtool-version: Bump the libubsan SONAME.
        * asan/Makefile.in: Regenerate.
        * lsan/Makefile.in: Regenerate.
        * sanitizer_common/Makefile.in: Regenerate.
        * tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.


	Jakub

Comments

Martin Liška Oct. 18, 2017, 9 a.m. UTC | #1
Hi.

I would like to use this thread to slightly describe differences in GCC and LLVM.
I compared options support by both and:

UBSAN:

1)
gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-arg’
gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-assign’
gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-return’

I guess it's covered by -fsanitize=nonnull-attribute and -fsanitize=returns-nonnull-attribute.
One can't have in GCC a local variable with non-null attribute (nullability-assign), right?

2) unsigned-integer-overflow

As documented, not being a real UBSAN. Do we want that or seen as not useful?

3) function

Indirect function pointer comparison using RTTI in C++. Would it be useful? Ideas?

ASAN:

For ASAN, there's quite up-to-date page: https://github.com/google/sanitizers/wiki/AddressSanitizerClangVsGCC-(5.0-vs-7.1)

The page is quite up-to-date. Currently we should cover all what LLVM supports. Am I right? Or is there any interesting
feature we miss?

Thanks for ideas,
Martin
Jakub Jelinek Oct. 18, 2017, 9:16 a.m. UTC | #2
On Wed, Oct 18, 2017 at 11:00:30AM +0200, Martin Liška wrote:
> Hi.
> 
> I would like to use this thread to slightly describe differences in GCC and LLVM.
> I compared options support by both and:
> 
> UBSAN:
> 
> 1)
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-arg’
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-assign’
> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-return’

I believe those are for diagnostic of some Objective-C addition, some
_Nullable and _Nonnull keywords on (pointer) types.  Seems LLVM supports it as an
extension even for C/C++.

> I guess it's covered by -fsanitize=nonnull-attribute and -fsanitize=returns-nonnull-attribute.
> One can't have in GCC a local variable with non-null attribute (nullability-assign), right?
> 
> 2) unsigned-integer-overflow
> 
> As documented, not being a real UBSAN. Do we want that or seen as not useful?

This one is not implemented on purpose, it doesn't make any sense to me.

> 3) function
> 
> Indirect function pointer comparison using RTTI in C++. Would it be useful? Ideas?

Dunno what this one is about.

4) builtin

Which I've posted yesterday patch for.

> ASAN:
> 
> For ASAN, there's quite up-to-date page: https://github.com/google/sanitizers/wiki/AddressSanitizerClangVsGCC-(5.0-vs-7.1)
> 
> The page is quite up-to-date. Currently we should cover all what LLVM supports. Am I right? Or is there any interesting
> feature we miss?

As I said on IRC, we probably should be redirecting at sanopt or asan pass
__builtin_memcpy etc. calls to __asan_memcpy etc.

	Jakub
Martin Liška Oct. 18, 2017, 10:35 a.m. UTC | #3
On 10/18/2017 11:16 AM, Jakub Jelinek wrote:
> On Wed, Oct 18, 2017 at 11:00:30AM +0200, Martin Liška wrote:
>> Hi.
>>
>> I would like to use this thread to slightly describe differences in GCC and LLVM.
>> I compared options support by both and:
>>
>> UBSAN:
>>
>> 1)
>> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-arg’
>> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-assign’
>> gcc: error: unrecognized argument to -fsanitize= option: ‘nullability-return’
> 
> I believe those are for diagnostic of some Objective-C addition, some
> _Nullable and _Nonnull keywords on (pointer) types.  Seems LLVM supports it as an
> extension even for C/C++.

Ok.

> 
>> I guess it's covered by -fsanitize=nonnull-attribute and -fsanitize=returns-nonnull-attribute.
>> One can't have in GCC a local variable with non-null attribute (nullability-assign), right?
>>
>> 2) unsigned-integer-overflow
>>
>> As documented, not being a real UBSAN. Do we want that or seen as not useful?
> 
> This one is not implemented on purpose, it doesn't make any sense to me.

Works for me.

> 
>> 3) function
>>
>> Indirect function pointer comparison using RTTI in C++. Would it be useful? Ideas?
> 
> Dunno what this one is about.

$ cat indir.cpp 
void foo(void) { }

struct A
{
  static int bar(void) { return 0; }
};

void call (int (*f) (void))
{
  f();
}

int main()
{
  A a;
  call ((int (*) (void))&foo);
}

$ ~/bin/llvm/bin/clang++ -fsanitize=function /tmp/indir.cpp && ./a.out
/tmp/indir.cpp:10:3: runtime error: call to function foo() through pointer to incorrect function type 'int (*)()'
(/tmp/a.out+0x42b9b0): note: foo() defined here

> 
> 4) builtin
> 
> Which I've posted yesterday patch for.

I noticed, thanks!

> 
>> ASAN:
>>
>> For ASAN, there's quite up-to-date page: https://github.com/google/sanitizers/wiki/AddressSanitizerClangVsGCC-(5.0-vs-7.1)
>>
>> The page is quite up-to-date. Currently we should cover all what LLVM supports. Am I right? Or is there any interesting
>> feature we miss?
> 
> As I said on IRC, we probably should be redirecting at sanopt or asan pass
> __builtin_memcpy etc. calls to __asan_memcpy etc.

I'll take a look.

Martin

> 
> 	Jakub
>
Jakub Jelinek Oct. 19, 2017, 10:52 a.m. UTC | #4
On Mon, Oct 16, 2017 at 08:52:50PM +0200, Jakub Jelinek wrote:
> The following patch is an attempt at libsanitizer merge from upstream.
> Sadly libubsan has several ABI incompatible changes, dunno if we should
> fight the mess and re-add backward compatibility back, or as the patch
> does just bump soname, upstream clearly doesn't care about ABI compatibility
> at all.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, it would be nice to
> get it tested on other targets (e.g. darwin, that breaks almost all the time
> when doing merges, but no access to that).
> 
> Included is just the non-libsanitizer/ part plus GCC owned file changes
> in libsanitizer (except regenerated ones), attached is bzip2ed full patch.
> 
> Thoughts on this?

Seems I've missed two test failures during the testing, this incremental patch ought
to fix that (with LTO we optimize away __asan_default_options and thus the
test fails, and libasan changed the env var handling, instead of having
handle_segv={0,1} it now has {0,1,2} modes and the old default 1 mode is now
the non-default mode 2, which the test relies on.

To answer my own question about possibility to avoid libubsan soname bump,
seems that is really not possible, because they removed already before
last merge __ubsan_handle_cfi_bad_type{,_abort} entrypoints (which we've
added back to make the library backwards compatible), but now they have
added __ubsan_handle_cfi_bad_type again with a different signature!
Argh!

Is the patch (the merge + this incremental) ok for trunk?

2017-10-19  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/asan/default-options-1.C (__asan_default_options): Add
	used attribute.
	* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
	in the environment.

--- gcc/testsuite/g++.dg/asan/default-options-1.C.jj	2015-10-29 09:14:39.000000000 +0100
+++ gcc/testsuite/g++.dg/asan/default-options-1.C	2017-10-19 12:09:26.367324880 +0200
@@ -3,7 +3,7 @@
 const char *kAsanDefaultOptions="verbosity=1 foo=bar";
 
 extern "C"
-__attribute__((no_sanitize_address))
+__attribute__((no_sanitize_address, used))
 const char *__asan_default_options() {
   return kAsanDefaultOptions;
 }
--- gcc/testsuite/g++.dg/asan/asan_test.C.jj	2017-01-24 09:27:20.000000000 +0100
+++ gcc/testsuite/g++.dg/asan/asan_test.C	2017-10-19 12:06:27.453510604 +0200
@@ -8,6 +8,7 @@
 // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } }
 // { dg-additional-options "-msse2" { target { i?86-*-linux* x86_64-*-linux* } } }
 // { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
+// { dg-set-target-env-var ASAN_OPTIONS "handle_segv=2" }
 // { dg-final { asan-gtest } }
 
 #include "asan_test.cc"


	Jakub
Maxim Ostapenko Oct. 19, 2017, 11:07 a.m. UTC | #5
Hi, I'm sorry for a late response.

On 19/10/17 13:52, Jakub Jelinek wrote:
> On Mon, Oct 16, 2017 at 08:52:50PM +0200, Jakub Jelinek wrote:
>> The following patch is an attempt at libsanitizer merge from upstream.
>> Sadly libubsan has several ABI incompatible changes, dunno if we should
>> fight the mess and re-add backward compatibility back, or as the patch
>> does just bump soname, upstream clearly doesn't care about ABI compatibility
>> at all.
>>
>> Bootstrapped/regtested on x86_64-linux and i686-linux, it would be nice to
>> get it tested on other targets (e.g. darwin, that breaks almost all the time
>> when doing merges, but no access to that).
>>
>> Included is just the non-libsanitizer/ part plus GCC owned file changes
>> in libsanitizer (except regenerated ones), attached is bzip2ed full patch.
>>
>> Thoughts on this?
> Seems I've missed two test failures during the testing, this incremental patch ought
> to fix that (with LTO we optimize away __asan_default_options and thus the
> test fails, and libasan changed the env var handling, instead of having
> handle_segv={0,1} it now has {0,1,2} modes and the old default 1 mode is now
> the non-default mode 2, which the test relies on.
>
> To answer my own question about possibility to avoid libubsan soname bump,
> seems that is really not possible, because they removed already before
> last merge __ubsan_handle_cfi_bad_type{,_abort} entrypoints (which we've
> added back to make the library backwards compatible), but now they have
> added __ubsan_handle_cfi_bad_type again with a different signature!
> Argh!
>
> Is the patch (the merge + this incremental) ok for trunk?

I think the patch is OK, just wondering about two things:

1) We have a bunch of GCC local patches, did you include them into a 
cumulative patch (I guess yes)?
2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them 
in GCC too?

-Maxim

>
> 2017-10-19  Jakub Jelinek  <jakub@redhat.com>
>
> 	* g++.dg/asan/default-options-1.C (__asan_default_options): Add
> 	used attribute.
> 	* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
> 	in the environment.
>
> --- gcc/testsuite/g++.dg/asan/default-options-1.C.jj	2015-10-29 09:14:39.000000000 +0100
> +++ gcc/testsuite/g++.dg/asan/default-options-1.C	2017-10-19 12:09:26.367324880 +0200
> @@ -3,7 +3,7 @@
>   const char *kAsanDefaultOptions="verbosity=1 foo=bar";
>   
>   extern "C"
> -__attribute__((no_sanitize_address))
> +__attribute__((no_sanitize_address, used))
>   const char *__asan_default_options() {
>     return kAsanDefaultOptions;
>   }
> --- gcc/testsuite/g++.dg/asan/asan_test.C.jj	2017-01-24 09:27:20.000000000 +0100
> +++ gcc/testsuite/g++.dg/asan/asan_test.C	2017-10-19 12:06:27.453510604 +0200
> @@ -8,6 +8,7 @@
>   // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } }
>   // { dg-additional-options "-msse2" { target { i?86-*-linux* x86_64-*-linux* } } }
>   // { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
> +// { dg-set-target-env-var ASAN_OPTIONS "handle_segv=2" }
>   // { dg-final { asan-gtest } }
>   
>   #include "asan_test.cc"
>
>
> 	Jakub
>
>
>
Kamil Rytarowski Oct. 19, 2017, 11:14 a.m. UTC | #6
On 19.10.2017 13:17, Jakub Jelinek wrote:
> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>> Is the patch (the merge + this incremental) ok for trunk?
>>
>> I think the patch is OK, just wondering about two things:
> 
> Richi just approved the patch on IRC, so I'll commit, then we can deal with
> follow-ups.
> 
>> 1) We have a bunch of GCC local patches, did you include them into a
>> cumulative patch (I guess yes)?
> 
> I have done some verification today, diff from upstream r285547 to unpatched
> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
> and diff from upstream r315899 to patched GCC (again, two liners removed),
> attached P2 and went through the changes in P1 and verified that except for
> the ubsan backwards compatibility we had that can't work anymore everything
> else was upstreamed, or remained in P2.  So P2 is the current diff from
> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
> changes now filed upstream.
> 
>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>> GCC too?
> 
> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
> out of liblsan and link it into executables, will handle it next (there is a
> PR about it, just wanted to wait until the merge is in).
> 
> 	Jakub
> 

NetBSD/amd64 ships now with asan, ubsan, libfuzzer (WIP) and safestack
upstreamed.

tsan is work-in-progress and it will be followed by msan.

"make check-tsan" with local patches results so far:

Expected Passes    : 248
Expected Failures  : 1
Unsupported Tests  : 83
Unexpected Failures: 44

It's worth to enable the upstreamed features on the GCC/NetBSD frontend
as well. We are doing it currently downstream in the NetBSD distribution.
Jakub Jelinek Oct. 19, 2017, 11:17 a.m. UTC | #7
On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
> > Is the patch (the merge + this incremental) ok for trunk?
> 
> I think the patch is OK, just wondering about two things:

Richi just approved the patch on IRC, so I'll commit, then we can deal with
follow-ups.

> 1) We have a bunch of GCC local patches, did you include them into a
> cumulative patch (I guess yes)?

I have done some verification today, diff from upstream r285547 to unpatched
GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
and diff from upstream r315899 to patched GCC (again, two liners removed),
attached P2 and went through the changes in P1 and verified that except for
the ubsan backwards compatibility we had that can't work anymore everything
else was upstreamed, or remained in P2.  So P2 is the current diff from
upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
changes now filed upstream.

> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
> GCC too?

Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
out of liblsan and link it into executables, will handle it next (there is a
PR about it, just wanted to wait until the merge is in).

	Jakub
--- /usr/src/llvm/projects/compiler-rt.285547/lib/asan/asan_globals.cc	2017-10-19 10:29:52.916249242 +0200
+++ asan/asan_globals.cc	2017-10-19 09:17:31.163837518 +0200
@@ -149,23 +147,6 @@ static void CheckODRViolationViaIndicato
   }
 }
 
-// Check ODR violation for given global G by checking if it's already poisoned.
-// We use this method in case compiler doesn't use private aliases for global
-// variables.
-static void CheckODRViolationViaPoisoning(const Global *g) {
-  if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) {
-    // This check may not be enough: if the first global is much larger
-    // the entire redzone of the second global may be within the first global.
-    for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
-      if (g->beg == l->g->beg &&
-          (flags()->detect_odr_violation >= 2 || g->size != l->g->size) &&
-          !IsODRViolationSuppressed(g->name))
-        ReportODRViolation(g, FindRegistrationSite(g),
-                           l->g, FindRegistrationSite(l->g));
-    }
-  }
-}
-
 // Clang provides two different ways for global variables protection:
 // it can poison the global itself or its private alias. In former
 // case we may poison same symbol multiple times, that can help us to
@@ -213,8 +194,6 @@ static void RegisterGlobal(const Global
     // where two globals with the same name are defined in different modules.
     if (UseODRIndicator(g))
       CheckODRViolationViaIndicator(g);
-    else
-      CheckODRViolationViaPoisoning(g);
   }
   if (CanPoisonMemory())
     PoisonRedZones(*g);
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_common_interceptors.inc	2017-10-19 10:29:53.330243835 +0200
+++ sanitizer_common/sanitizer_common_interceptors.inc	2017-10-19 09:17:31.139837810 +0200
@@ -3352,7 +3350,8 @@ INTERCEPTOR(int, getgroups, int size, u3
   // its metadata. See
   // https://github.com/google/sanitizers/issues/321.
   int res = REAL(getgroups)(size, lst);
-  if (res && lst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
+  if (res >= 0 && lst && size > 0)
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
   return res;
 }
 #define INIT_GETGROUPS COMMON_INTERCEPT_FUNCTION(getgroups);
@@ -4552,11 +4551,15 @@ void *__tls_get_addr_opt(void *arg);
 //   descriptor offset as an argument instead of a pointer.  GOT address
 //   is passed in r12, so it's necessary to write it in assembly.  This is
 //   the function used by the compiler.
-#define INIT_TLS_GET_ADDR COMMON_INTERCEPT_FUNCTION(__tls_get_addr_internal)
+extern "C" uptr __tls_get_offset_wrapper(void *arg, uptr (*fn)(void *arg));
+#define INIT_TLS_GET_ADDR COMMON_INTERCEPT_FUNCTION(__tls_get_offset)
+DEFINE_REAL(uptr, __tls_get_offset, void *arg)
+extern "C" uptr __tls_get_offset(void *arg);
+extern "C" uptr __interceptor___tls_get_offset(void *arg);
 INTERCEPTOR(uptr, __tls_get_addr_internal, void *arg) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, __tls_get_addr_internal, arg);
-  uptr res = REAL(__tls_get_addr_internal)(arg);
+  uptr res = __tls_get_offset_wrapper(arg, REAL(__tls_get_offset));
   uptr tp = reinterpret_cast<uptr>(__builtin_thread_pointer());
   void *ptr = reinterpret_cast<void *>(res + tp);
   uptr tls_begin, tls_end;
@@ -4568,32 +4571,43 @@ INTERCEPTOR(uptr, __tls_get_addr_interna
   }
   return res;
 }
-// We need a protected symbol aliasing the above, so that we can jump
+// We need a hidden symbol aliasing the above, so that we can jump
 // directly to it from the assembly below.
 extern "C" __attribute__((alias("__interceptor___tls_get_addr_internal"),
-                          visibility("protected")))
-uptr __interceptor___tls_get_addr_internal_protected(void *arg);
+                          visibility("hidden")))
+uptr __tls_get_addr_hidden(void *arg);
 // Now carefully intercept __tls_get_offset.
 asm(
   ".text\n"
-  ".global __tls_get_offset\n"
-  "__tls_get_offset:\n"
 // The __intercept_ version has to exist, so that gen_dynamic_list.py
 // exports our symbol.
+  ".weak __tls_get_offset\n"
+  ".type __tls_get_offset, @function\n"
+  "__tls_get_offset:\n"
   ".global __interceptor___tls_get_offset\n"
+  ".type __interceptor___tls_get_offset, @function\n"
   "__interceptor___tls_get_offset:\n"
 #ifdef __s390x__
   "la %r2, 0(%r2,%r12)\n"
-  "jg __interceptor___tls_get_addr_internal_protected\n"
+  "jg __tls_get_addr_hidden\n"
 #else
   "basr %r3,0\n"
   "0: la %r2,0(%r2,%r12)\n"
   "l %r4,1f-0b(%r3)\n"
   "b 0(%r4,%r3)\n"
-  "1: .long __interceptor___tls_get_addr_internal_protected - 0b\n"
+  "1: .long __tls_get_addr_hidden - 0b\n"
 #endif
-  ".type __tls_get_offset, @function\n"
-  ".size __tls_get_offset, .-__tls_get_offset\n"
+  ".size __interceptor___tls_get_offset, .-__interceptor___tls_get_offset\n"
+// Assembly wrapper to call REAL(__tls_get_offset)(arg)
+  ".type __tls_get_offset_wrapper, @function\n"
+  "__tls_get_offset_wrapper:\n"
+#ifdef __s390x__
+  "sgr %r2,%r12\n"
+#else
+  "sr %r2,%r12\n"
+#endif
+  "br %r3\n"
+  ".size __tls_get_offset_wrapper, .-__tls_get_offset_wrapper\n"
 );
 #endif // SANITIZER_S390
 #else
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_internal_defs.h	2017-10-19 10:29:52.818250522 +0200
+++ sanitizer_common/sanitizer_internal_defs.h	2017-10-19 09:17:31.154837627 +0200
@@ -289,7 +287,12 @@ void NORETURN CheckFailed(const char *fi
 enum LinkerInitialized { LINKER_INITIALIZED = 0 };
 
 #if !defined(_MSC_VER) || defined(__clang__)
-# define GET_CALLER_PC() (uptr)__builtin_return_address(0)
+# if SANITIZER_S390_31
+#  define GET_CALLER_PC() \
+  (uptr)__builtin_extract_return_addr(__builtin_return_address(0))
+# else
+#  define GET_CALLER_PC() (uptr)__builtin_return_address(0)
+# endif
 # define GET_CURRENT_FRAME() (uptr)__builtin_frame_address(0)
 inline void Trap() {
   __builtin_trap();
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_linux.cc	2017-10-19 10:29:53.305244161 +0200
+++ sanitizer_common/sanitizer_linux.cc	2017-10-19 09:17:31.151837664 +0200
@@ -607,8 +605,7 @@ uptr internal_prctl(int option, uptr arg
 }
 #endif
 
-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }
 
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_linux.h	2017-10-19 10:29:52.816250548 +0200
+++ sanitizer_common/sanitizer_linux.h	2017-10-19 09:17:31.152837652 +0200
@@ -21,7 +19,6 @@
 #include "sanitizer_platform_limits_posix.h"
 
 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;
 
 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -30,8 +27,7 @@ struct linux_dirent;
 
 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-                          struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
     __sanitizer_sigset_t *oldset);
 
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_linux_s390.cc	2017-10-19 10:29:52.566253813 +0200
+++ sanitizer_common/sanitizer_linux_s390.cc	2017-10-19 09:17:31.139837810 +0200
@@ -136,6 +134,18 @@ static bool FixedCVE_2016_2143() {
   if (ptr[0] == '.')
     patch = internal_simple_strtoll(ptr+1, &ptr, 10);
   if (major < 3) {
+    if (major == 2 && minor == 6 && patch == 32 && ptr[0] == '-' &&
+        internal_strstr(ptr, ".el6")) {
+      // Check RHEL6
+      int r1 = internal_simple_strtoll(ptr+1, &ptr, 10);
+      if (r1 >= 657) // 2.6.32-657.el6 or later
+        return true;
+      if (r1 == 642 && ptr[0] == '.') {
+        int r2 = internal_simple_strtoll(ptr+1, &ptr, 10);
+        if (r2 >= 9) // 2.6.32-642.9.1.el6 or later
+          return true;
+      }
+    }
     // <3.0 is bad.
     return false;
   } else if (major == 3) {
@@ -145,6 +155,18 @@ static bool FixedCVE_2016_2143() {
     // 3.12.58+ is OK.
     if (minor == 12 && patch >= 58)
       return true;
+    if (minor == 10 && patch == 0 && ptr[0] == '-' &&
+        internal_strstr(ptr, ".el7")) {
+      // Check RHEL7
+      int r1 = internal_simple_strtoll(ptr+1, &ptr, 10);
+      if (r1 >= 426) // 3.10.0-426.el7 or later
+        return true;
+      if (r1 == 327 && ptr[0] == '.') {
+        int r2 = internal_simple_strtoll(ptr+1, &ptr, 10);
+        if (r2 >= 27) // 3.10.0-327.27.1.el7 or later
+          return true;
+      }
+    }
     // Otherwise, bad.
     return false;
   } else if (major == 4) {
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_mac.cc	2017-10-19 10:29:53.306244148 +0200
+++ sanitizer_common/sanitizer_mac.cc	2017-10-19 09:17:31.143837761 +0200
@@ -36,7 +34,7 @@
 extern char **environ;
 #endif
 
-#if defined(__has_include) && __has_include(<os/trace.h>)
+#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__BLOCKS__)
 #define SANITIZER_OS_TRACE 1
 #include <os/trace.h>
 #else
@@ -93,20 +91,22 @@ namespace __sanitizer {
 
 #include "sanitizer_syscall_generic.inc"
 
-// Direct syscalls, don't call libmalloc hooks.
+// Direct syscalls, don't call libmalloc hooks (but not available on 10.6).
 extern "C" void *__mmap(void *addr, size_t len, int prot, int flags, int fildes,
-                        off_t off);
-extern "C" int __munmap(void *, size_t);
+                        off_t off) SANITIZER_WEAK_ATTRIBUTE;
+extern "C" int __munmap(void *, size_t) SANITIZER_WEAK_ATTRIBUTE;
 
 // ---------------------- sanitizer_libc.h
 uptr internal_mmap(void *addr, size_t length, int prot, int flags,
                    int fd, u64 offset) {
   if (fd == -1) fd = VM_MAKE_TAG(VM_MEMORY_ANALYSIS_TOOL);
-  return (uptr)__mmap(addr, length, prot, flags, fd, offset);
+  if (__mmap) return (uptr)__mmap(addr, length, prot, flags, fd, offset);
+  return (uptr)mmap(addr, length, prot, flags, fd, offset);
 }
 
 uptr internal_munmap(void *addr, uptr length) {
-  return __munmap(addr, length);
+  if (__munmap) return __munmap(addr, length);
+  return munmap(addr, length);
 }
 
 int internal_mprotect(void *addr, uptr length, int prot) {
@@ -192,17 +192,19 @@ uptr internal_sigprocmask(int how, __san
   return sigprocmask(how, set, oldset);
 }
 
-// Doesn't call pthread_atfork() handlers.
-extern "C" pid_t __fork(void);
+// Doesn't call pthread_atfork() handlers (but not available on 10.6).
+extern "C" pid_t __fork(void) SANITIZER_WEAK_ATTRIBUTE;
 
 int internal_fork() {
-  return __fork();
+  if (__fork)
+    return __fork();
+  return fork();
 }
 
 int internal_forkpty(int *amaster) {
   int master, slave;
   if (openpty(&master, &slave, nullptr, nullptr, nullptr) == -1) return -1;
-  int pid = __fork();
+  int pid = internal_fork();
   if (pid == -1) {
     close(master);
     close(slave);
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_platform_interceptors.h	2017-10-19 10:29:52.826250417 +0200
+++ sanitizer_common/sanitizer_platform_interceptors.h	2017-10-19 09:17:31.141837786 +0200
@@ -83,8 +81,16 @@
 #define SANITIZER_INTERCEPT_MEMMOVE 1
 #define SANITIZER_INTERCEPT_MEMCPY 1
 #define SANITIZER_INTERCEPT_MEMCMP 1
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
+# define SI_MAC_DEPLOYMENT_BELOW_10_7 1
+#else
+# define SI_MAC_DEPLOYMENT_BELOW_10_7 0
+#endif
+// memmem on Darwin doesn't exist on 10.6
 // FIXME: enable memmem on Windows.
-#define SANITIZER_INTERCEPT_MEMMEM SI_NOT_WINDOWS
+#define SANITIZER_INTERCEPT_MEMMEM \
+  SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7
 #define SANITIZER_INTERCEPT_MEMCHR 1
 #define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX
 
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_platform_limits_linux.cc	2017-10-19 10:29:52.573253722 +0200
+++ sanitizer_common/sanitizer_platform_limits_linux.cc	2017-10-16 13:26:27.582029950 +0200
@@ -38,6 +36,7 @@
 #define uid_t __kernel_uid_t
 #define gid_t __kernel_gid_t
 #define off_t __kernel_off_t
+#define time_t __kernel_time_t
 // This header seems to contain the definitions of _kernel_ stat* structs.
 #include <asm/stat.h>
 #undef ino_t
@@ -64,7 +63,8 @@ namespace __sanitizer {
 }  // namespace __sanitizer
 
 #if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\
-                            && !defined(__mips__) && !defined(__s390__)
+                            && !defined(__mips__) && !defined(__s390__)\
+                            && !defined(__sparc__)
 COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
 #endif
 
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_platform_limits_posix.cc	2017-10-19 10:29:52.821250483 +0200
+++ sanitizer_common/sanitizer_platform_limits_posix.cc	2017-10-19 09:17:31.141837786 +0200
@@ -23,11 +21,6 @@
 #ifdef _FILE_OFFSET_BITS
 #undef _FILE_OFFSET_BITS
 #endif
-#if SANITIZER_FREEBSD
-#define _WANT_RTENTRY
-#include <sys/param.h>
-#include <sys/socketvar.h>
-#endif
 #include <arpa/inet.h>
 #include <dirent.h>
 #include <errno.h>
@@ -422,6 +415,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
   unsigned struct_input_absinfo_sz = sizeof(struct input_absinfo);
   unsigned struct_input_id_sz = sizeof(struct input_id);
   unsigned struct_mtpos_sz = sizeof(struct mtpos);
+  unsigned struct_rtentry_sz = sizeof(struct rtentry);
   unsigned struct_termio_sz = sizeof(struct termio);
   unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
   unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
@@ -441,7 +435,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
   unsigned struct_midi_info_sz = sizeof(struct midi_info);
   unsigned struct_mtget_sz = sizeof(struct mtget);
   unsigned struct_mtop_sz = sizeof(struct mtop);
-  unsigned struct_rtentry_sz = sizeof(struct rtentry);
   unsigned struct_sbi_instrument_sz = sizeof(struct sbi_instrument);
   unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec);
   unsigned struct_synth_info_sz = sizeof(struct synth_info);
diff -upr /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_platform_limits_posix.h sanitizer_common/sanitizer_platform_limits_posix.h
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_platform_limits_posix.h	2017-10-19 10:29:52.827250404 +0200
+++ sanitizer_common/sanitizer_platform_limits_posix.h	2017-10-19 09:17:31.142837773 +0200
@@ -27,6 +25,10 @@
 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
 #endif  // !SANITIZER_FREEBSD
 
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
 namespace __sanitizer {
   extern unsigned struct_utsname_sz;
   extern unsigned struct_stat_sz;
@@ -87,6 +89,14 @@ namespace __sanitizer {
 #elif defined(__s390x__)
   const unsigned struct_kernel_stat_sz = 144;
   const unsigned struct_kernel_stat64_sz = 0;
+#elif defined(__sparc__) && defined(__arch64__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 104;
+  const unsigned struct_kernel_stat64_sz = 144;
+#elif defined(__sparc__) && !defined(__arch64__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 64;
+  const unsigned struct_kernel_stat64_sz = 104;
 #endif
   struct __sanitizer_perf_event_attr {
     unsigned type;
@@ -109,7 +119,7 @@ namespace __sanitizer {
 
 #if defined(__powerpc64__) || defined(__s390__)
   const unsigned struct___old_kernel_stat_sz = 0;
-#else
+#elif !defined(__sparc__)
   const unsigned struct___old_kernel_stat_sz = 32;
 #endif
 
@@ -200,6 +210,18 @@ namespace __sanitizer {
     unsigned short __pad1;
     unsigned long __unused1;
     unsigned long __unused2;
+#elif defined(__sparc__)
+# if defined(__arch64__)
+    unsigned mode;
+    unsigned short __pad1;
+# else
+    unsigned short __pad1;
+    unsigned short mode;
+    unsigned short __pad2;
+# endif
+    unsigned short __seq;
+    unsigned long long __unused1;
+    unsigned long long __unused2;
 #else
     unsigned short mode;
     unsigned short __pad1;
@@ -217,6 +239,26 @@ namespace __sanitizer {
 
   struct __sanitizer_shmid_ds {
     __sanitizer_ipc_perm shm_perm;
+  #if defined(__sparc__)
+  # if !defined(__arch64__)
+    u32 __pad1;
+  # endif
+    long shm_atime;
+  # if !defined(__arch64__)
+    u32 __pad2;
+  # endif
+    long shm_dtime;
+  # if !defined(__arch64__)
+    u32 __pad3;
+  # endif
+    long shm_ctime;
+    uptr shm_segsz;
+    int shm_cpid;
+    int shm_lpid;
+    unsigned long shm_nattch;
+    unsigned long __glibc_reserved1;
+    unsigned long __glibc_reserved2;
+  #else
   #ifndef __powerpc__
     uptr shm_segsz;
   #elif !defined(__powerpc64__)
@@ -254,6 +296,7 @@ namespace __sanitizer {
     uptr __unused4;
     uptr __unused5;
   #endif
+#endif
   };
 #elif SANITIZER_FREEBSD
   struct __sanitizer_ipc_perm {
@@ -588,7 +631,21 @@ namespace __sanitizer {
     __sanitizer_sigset_t sa_mask;
 #endif
 #ifndef __mips__
+#if defined(__sparc__)
+#if __GLIBC_PREREQ (2, 20)
+    // On sparc glibc 2.19 and earlier sa_flags was unsigned long.
+#if defined(__arch64__)
+    // To maintain ABI compatibility on sparc64 when switching to an int,
+    // __glibc_reserved0 was added.
+    int __glibc_reserved0;
+#endif
     int sa_flags;
+#else
+    unsigned long sa_flags;
+#endif
+#else
+    int sa_flags;
+#endif
 #endif
 #endif
 #if SANITIZER_LINUX
@@ -851,7 +908,7 @@ struct __sanitizer_cookie_io_functions_t
 
 #define IOC_NRBITS 8
 #define IOC_TYPEBITS 8
-#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__)
+#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || defined(__sparc__)
 #define IOC_SIZEBITS 13
 #define IOC_DIRBITS 3
 #define IOC_NONE 1U
@@ -881,7 +938,17 @@ struct __sanitizer_cookie_io_functions_t
 #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
 #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
 #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
+
+#if defined(__sparc__)
+// In sparc the 14 bits SIZE field overlaps with the
+// least significant bit of DIR, so either IOC_READ or
+// IOC_WRITE shall be 1 in order to get a non-zero SIZE.
+# define IOC_SIZE(nr)                       \
+  ((((((nr) >> 29) & 0x7) & (4U|2U)) == 0)? \
+   0 : (((nr) >> 16) & 0x3fff))
+#else
 #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
+#endif
 
   extern unsigned struct_ifreq_sz;
   extern unsigned struct_termios_sz;
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_stacktrace.cc	2017-10-19 10:29:52.833250326 +0200
+++ sanitizer_common/sanitizer_stacktrace.cc	2017-10-19 09:17:31.155837615 +0200
@@ -57,8 +55,8 @@ static inline uhwptr *GetCanonicFrame(up
   // Nope, this does not look right either. This means the frame after next does
   // not have a valid frame pointer, but we can still extract the caller PC.
   // Unfortunately, there is no way to decide between GCC and LLVM frame
-  // layouts. Assume LLVM.
-  return bp_prev;
+  // layouts. Assume GCC.
+  return bp_prev - 1;
 #else
   return (uhwptr*)bp;
 #endif
--- /usr/src/llvm/projects/compiler-rt.285547/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc	2017-10-19 10:29:52.835250300 +0200
+++ sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc	2017-10-19 09:17:31.137837834 +0200
@@ -275,7 +273,7 @@ static int TracerThread(void* argument)
 
   // Alternate stack for signal handling.
   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(&handler_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_checks.inc	2017-10-19 10:30:18.061920811 +0200
+++ ubsan/ubsan_checks.inc	2017-10-19 09:17:31.133837883 +0200
@@ -19,6 +17,7 @@
 
 UBSAN_CHECK(GenericUB, "undefined-behavior", "undefined")
 UBSAN_CHECK(NullPointerUse, "null-pointer-use", "null")
+UBSAN_CHECK(PointerOverflow, "pointer-overflow", "pointer-overflow")
 UBSAN_CHECK(MisalignedPointerUse, "misaligned-pointer-use", "alignment")
 UBSAN_CHECK(InsufficientObjectSize, "insufficient-object-size", "object-size")
 UBSAN_CHECK(SignedIntegerOverflow, "signed-integer-overflow",
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers.cc	2017-10-19 10:30:18.062920798 +0200
+++ ubsan/ubsan_handlers.cc	2017-10-19 09:17:31.134837871 +0200
@@ -523,6 +521,37 @@ void __ubsan::__ubsan_handle_nonnull_arg
   Die();
 }
 
+static void handlePointerOverflowImpl(PointerOverflowData *Data,
+                                      ValueHandle Base,
+                                      ValueHandle Result,
+                                      ReportOptions Opts) {
+  SourceLocation Loc = Data->Loc.acquire();
+  ErrorType ET = ErrorType::PointerOverflow;
+
+  if (ignoreReport(Loc, Opts, ET))
+    return;
+
+  ScopedReport R(Opts, Loc, ET);
+
+  Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1")
+    << (void *)Base << (void*)Result;
+}
+
+void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data,
+                                              ValueHandle Base,
+                                              ValueHandle Result) {
+  GET_REPORT_OPTIONS(false);
+  handlePointerOverflowImpl(Data, Base, Result, Opts);
+}
+
+void __ubsan::__ubsan_handle_pointer_overflow_abort(PointerOverflowData *Data,
+                                                    ValueHandle Base,
+                                                    ValueHandle Result) {
+  GET_REPORT_OPTIONS(true);
+  handlePointerOverflowImpl(Data, Base, Result, Opts);
+  Die();
+}
+
 static void handleCFIBadIcall(CFICheckFailData *Data, ValueHandle Function,
                               ReportOptions Opts) {
   if (Data->CheckKind != CFITCK_ICall)
@@ -560,6 +589,21 @@ static void HandleCFIBadType(CFICheckFai
 #endif
 }  // namespace __ubsan
 
+void __ubsan::__ubsan_handle_cfi_bad_icall(CFIBadIcallData *CallData,
+                                           ValueHandle Function) {
+  GET_REPORT_OPTIONS(false);
+  CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
+  handleCFIBadIcall(&Data, Function, Opts);
+}
+
+void __ubsan::__ubsan_handle_cfi_bad_icall_abort(CFIBadIcallData *CallData,
+                                                 ValueHandle Function) {
+  GET_REPORT_OPTIONS(true);
+  CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
+  handleCFIBadIcall(&Data, Function, Opts);
+  Die();
+}
+
 void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data,
                                             ValueHandle Value,
                                             uptr ValidVtable) {
diff -upr /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers_cxx.cc ubsan/ubsan_handlers_cxx.cc
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers_cxx.cc	2017-10-19 10:30:18.060920824 +0200
+++ ubsan/ubsan_handlers_cxx.cc	2017-10-19 09:17:31.132837895 +0200
@@ -144,4 +142,22 @@ void HandleCFIBadType(CFICheckFailData *
 }
 }  // namespace __ubsan
 
+void __ubsan::__ubsan_handle_cfi_bad_type(CFIBadTypeData *TypeData,
+                                          ValueHandle Vtable) {
+  GET_REPORT_OPTIONS(false);
+  CFITypeCheckKind TypeCheckKind
+    = static_cast<CFITypeCheckKind> (TypeData->TypeCheckKind);
+  CFICheckFailData Data = {TypeCheckKind, TypeData->Loc, TypeData->Type};
+  HandleCFIBadType(&Data, Vtable, false, Opts);
+}
+
+void __ubsan::__ubsan_handle_cfi_bad_type_abort(CFIBadTypeData *TypeData,
+                                                ValueHandle Vtable) {
+  GET_REPORT_OPTIONS(true);
+  CFITypeCheckKind TypeCheckKind
+    = static_cast<CFITypeCheckKind> (TypeData->TypeCheckKind);
+  CFICheckFailData Data = {TypeCheckKind, TypeData->Loc, TypeData->Type};
+  HandleCFIBadType(&Data, Vtable, false, Opts);
+}
+
 #endif // CAN_SANITIZE_UB
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers_cxx.h	2016-05-17 10:47:06.700073119 +0200
+++ ubsan/ubsan_handlers_cxx.h	2017-10-19 09:17:31.133837883 +0200
@@ -25,6 +23,12 @@ struct DynamicTypeCacheMissData {
   unsigned char TypeCheckKind;
 };
 
+struct CFIBadTypeData {
+  SourceLocation Loc;
+  const TypeDescriptor &Type;
+  unsigned char TypeCheckKind;
+};
+
 /// \brief Handle a runtime type check failure, caused by an incorrect vptr.
 /// When this handler is called, all we know is that the type was not in the
 /// cache; this does not necessarily imply the existence of a bug.
@@ -34,6 +38,13 @@ void __ubsan_handle_dynamic_type_cache_m
 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
 void __ubsan_handle_dynamic_type_cache_miss_abort(
   DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
+
+/// \brief Handle a control flow integrity check failure by printing a
+/// diagnostic.
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
+__ubsan_handle_cfi_bad_type(CFIBadTypeData *Data, ValueHandle Vtable);
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
+__ubsan_handle_cfi_bad_type_abort(CFIBadTypeData *Data, ValueHandle Vtable);
 }
 
 #endif // UBSAN_HANDLERS_H
diff -upr /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers.h ubsan/ubsan_handlers.h
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_handlers.h	2017-10-19 10:30:18.064920772 +0200
+++ ubsan/ubsan_handlers.h	2017-10-19 09:17:31.134837871 +0200
@@ -148,6 +146,13 @@ struct NonNullArgData {
 /// \brief Handle passing null pointer to function with nonnull attribute.
 RECOVERABLE(nonnull_arg, NonNullArgData *Data)
 
+struct PointerOverflowData {
+  SourceLocation Loc;
+};
+
+RECOVERABLE(pointer_overflow, PointerOverflowData *Data, ValueHandle Base,
+            ValueHandle Result)
+
 /// \brief Known CFI check kinds.
 /// Keep in sync with the enum of the same name in CodeGenFunction.h
 enum CFITypeCheckKind : unsigned char {
@@ -158,12 +163,20 @@ enum CFITypeCheckKind : unsigned char {
   CFITCK_ICall,
 };
 
+struct CFIBadIcallData {
+  SourceLocation Loc;
+  const TypeDescriptor &Type;
+};
+
 struct CFICheckFailData {
   CFITypeCheckKind CheckKind;
   SourceLocation Loc;
   const TypeDescriptor &Type;
 };
 
+/// \brief Handle control flow integrity failure for indirect function calls.
+RECOVERABLE(cfi_bad_icall, CFIBadIcallData *Data, ValueHandle Function)
+
 /// \brief Handle control flow integrity failures.
 RECOVERABLE(cfi_check_fail, CFICheckFailData *Data, ValueHandle Function,
             uptr VtableIsValid)
--- /usr/src/llvm/projects/compiler-rt.285547/lib/ubsan/ubsan_platform.h	2017-10-19 10:29:52.427255629 +0200
+++ ubsan/ubsan_platform.h	2017-10-19 09:17:31.133837883 +0200
@@ -13,6 +11,7 @@
 #ifndef UBSAN_PLATFORM_H
 #define UBSAN_PLATFORM_H
 
+#ifndef CAN_SANITIZE_UB
 // Other platforms should be easy to add, and probably work as-is.
 #if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \
     (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
@@ -24,5 +23,6 @@
 #else
 # define CAN_SANITIZE_UB 0
 #endif
+#endif //CAN_SANITIZE_UB
 
 #endif
--- /usr/src/llvm/projects/compiler-rt.285547/lib/tsan/rtl/tsan_interface_atomic.cc	2017-10-19 10:29:53.124246525 +0200
+++ tsan/tsan_interface_atomic.cc	2017-10-19 09:17:31.128837944 +0200
@@ -450,10 +448,27 @@ static void AtomicFence(ThreadState *thr
 
 // C/C++
 
+static morder covert_morder(morder mo) {
+  if (flags()->force_seq_cst_atomics)
+    return (morder)mo_seq_cst;
+
+  // Filter out additional memory order flags:
+  // MEMMODEL_SYNC        = 1 << 15
+  // __ATOMIC_HLE_ACQUIRE = 1 << 16
+  // __ATOMIC_HLE_RELEASE = 1 << 17
+  //
+  // HLE is an optimization, and we pretend that elision always fails.
+  // MEMMODEL_SYNC is used when lowering __sync_ atomics,
+  // since we use __sync_ atomics for actual atomic operations,
+  // we can safely ignore it as well. It also subtly affects semantics,
+  // but we don't model the difference.
+  return (morder)(mo & 0x7fff);
+}
+
 #define SCOPED_ATOMIC(func, ...) \
     const uptr callpc = (uptr)__builtin_return_address(0); \
     uptr pc = StackTrace::GetCurrentPc(); \
-    mo = flags()->force_seq_cst_atomics ? (morder)mo_seq_cst : mo; \
+    mo = covert_morder(mo); \
     ThreadState *const thr = cur_thread(); \
     if (thr->ignore_interceptors) \
       return NoTsanAtomic##func(__VA_ARGS__); \
--- /usr/src/llvm/projects/compiler-rt.285547/lib/tsan/rtl/tsan_platform_linux.cc	2017-10-19 10:29:52.992248249 +0200
+++ tsan/tsan_platform_linux.cc	2017-10-19 09:17:31.129837932 +0200
@@ -289,7 +287,7 @@ void InitializePlatform() {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  struct __res_state *statp = (struct __res_state*)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
       fds[cnt++] = statp->_u._ext.nssocks[i];
--- /usr/src/llvm/projects/compiler-rt.285547/lib/tsan/rtl/tsan_rtl.cc	2017-10-19 10:29:53.167245964 +0200
+++ tsan/tsan_rtl.cc	2017-10-19 09:17:31.121838029 +0200
@@ -45,6 +43,7 @@ extern "C" void __tsan_resume() {
 namespace __tsan {
 
 #if !SANITIZER_GO && !SANITIZER_MAC
+  __attribute__((tls_model("initial-exec")))
 THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState)] ALIGNED(64);
 #endif
 static char ctx_placeholder[sizeof(Context)] ALIGNED(64);
--- /usr/src/llvm/projects/compiler-rt.315899/lib/asan/asan_globals.cc	2017-10-16 13:15:29.231304156 +0200
+++ asan/asan_globals.cc	2017-10-19 11:17:30.063515687 +0200
@@ -149,23 +147,6 @@ static void CheckODRViolationViaIndicato
   }
 }
 
-// Check ODR violation for given global G by checking if it's already poisoned.
-// We use this method in case compiler doesn't use private aliases for global
-// variables.
-static void CheckODRViolationViaPoisoning(const Global *g) {
-  if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) {
-    // This check may not be enough: if the first global is much larger
-    // the entire redzone of the second global may be within the first global.
-    for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
-      if (g->beg == l->g->beg &&
-          (flags()->detect_odr_violation >= 2 || g->size != l->g->size) &&
-          !IsODRViolationSuppressed(g->name))
-        ReportODRViolation(g, FindRegistrationSite(g),
-                           l->g, FindRegistrationSite(l->g));
-    }
-  }
-}
-
 // Clang provides two different ways for global variables protection:
 // it can poison the global itself or its private alias. In former
 // case we may poison same symbol multiple times, that can help us to
@@ -213,8 +194,6 @@ static void RegisterGlobal(const Global
     // where two globals with the same name are defined in different modules.
     if (UseODRIndicator(g))
       CheckODRViolationViaIndicator(g);
-    else
-      CheckODRViolationViaPoisoning(g);
   }
   if (CanPoisonMemory())
     PoisonRedZones(*g);
--- /usr/src/llvm/projects/compiler-rt.315899/lib/sanitizer_common/sanitizer_mac.cc	2017-10-16 13:15:28.767309991 +0200
+++ sanitizer_common/sanitizer_mac.cc	2017-10-19 11:17:30.098515256 +0200
@@ -37,7 +35,7 @@
 extern char **environ;
 #endif
 
-#if defined(__has_include) && __has_include(<os/trace.h>)
+#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__BLOCKS__)
 #define SANITIZER_OS_TRACE 1
 #include <os/trace.h>
 #else
--- /usr/src/llvm/projects/compiler-rt.315899/lib/sanitizer_common/sanitizer_stacktrace.cc	2017-06-06 12:33:41.951512038 +0200
+++ sanitizer_common/sanitizer_stacktrace.cc	2017-10-19 11:17:30.105515170 +0200
@@ -57,8 +55,8 @@ static inline uhwptr *GetCanonicFrame(up
   // Nope, this does not look right either. This means the frame after next does
   // not have a valid frame pointer, but we can still extract the caller PC.
   // Unfortunately, there is no way to decide between GCC and LLVM frame
-  // layouts. Assume LLVM.
-  return bp_prev;
+  // layouts. Assume GCC.
+  return bp_prev - 1;
 #else
   return (uhwptr*)bp;
 #endif
--- /usr/src/llvm/projects/compiler-rt.315899/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc	2017-10-19 10:30:45.124567343 +0200
+++ sanitizer_common/sanitizer_symbolizer_libbacktrace.cc	2017-10-19 11:17:30.108515133 +0200
@@ -95,7 +93,8 @@ struct SymbolizeCodeCallbackArg {
     if (frames_symbolized > 0) {
       SymbolizedStack *cur = SymbolizedStack::New(addr);
       AddressInfo *info = &cur->info;
-      info->FillModuleInfo(first->info.module, first->info.module_offset);
+      info->FillModuleInfo(first->info.module, first->info.module_offset,
+                           first->info.module_arch);
       last->next = cur;
       last = cur;
     }
--- /usr/src/llvm/projects/compiler-rt.315899/lib/ubsan/ubsan_handlers_cxx.cc	2017-10-19 10:30:45.122567369 +0200
+++ ubsan/ubsan_handlers_cxx.cc	2017-10-19 11:17:30.125514924 +0200
@@ -123,6 +121,7 @@ void __ubsan_handle_cfi_bad_type(CFIChec
     CheckKindStr = "cast to unrelated type";
     break;
   case CFITCK_ICall:
+  default:
     Die();
   }
 
--- /usr/src/llvm/projects/compiler-rt.315899/lib/ubsan/ubsan_platform.h	2017-09-05 16:22:49.032429239 +0200
+++ ubsan/ubsan_platform.h	2017-10-19 11:17:30.126514912 +0200
@@ -13,6 +11,7 @@
 #ifndef UBSAN_PLATFORM_H
 #define UBSAN_PLATFORM_H
 
+#ifndef CAN_SANITIZE_UB
 // Other platforms should be easy to add, and probably work as-is.
 #if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) ||       \
      defined(__NetBSD__)) &&                                                   \
@@ -25,5 +24,6 @@
 #else
 # define CAN_SANITIZE_UB 0
 #endif
+#endif //CAN_SANITIZE_UB
 
 #endif
Eric Gallager Oct. 19, 2017, 6:30 p.m. UTC | #8
On 10/19/17, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>> > Is the patch (the merge + this incremental) ok for trunk?
>>
>> I think the patch is OK, just wondering about two things:
>
> Richi just approved the patch on IRC, so I'll commit, then we can deal with
> follow-ups.
>
>> 1) We have a bunch of GCC local patches, did you include them into a
>> cumulative patch (I guess yes)?
>
> I have done some verification today, diff from upstream r285547 to
> unpatched
> GCC (with the LLVM Compiler infrastructure two liners removed), attached
> P1,
> and diff from upstream r315899 to patched GCC (again, two liners removed),
> attached P2 and went through the changes in P1 and verified that except for
> the ubsan backwards compatibility we had that can't work anymore everything
> else was upstreamed, or remained in P2.  So P2 is the current diff from
> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
> changes now filed upstream.
>
>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them
>> in GCC too?
>
> Maybe, feel free to post patches.  For LSan we need to split off
> lsan_preinit
> out of liblsan and link it into executables, will handle it next (there is
> a PR about it, just wanted to wait until the merge is in).
>

Just for reference, the PR number is bug 82595 btw, for anyone reading
who isn't already on it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82595

> 	Jakub
>
Christophe Lyon Oct. 20, 2017, 10:45 a.m. UTC | #9
Hi,

On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>> > Is the patch (the merge + this incremental) ok for trunk?
>>
>> I think the patch is OK, just wondering about two things:
>
> Richi just approved the patch on IRC, so I'll commit, then we can deal with
> follow-ups.
>

Does anyone else run these tests on arm?
Since you applied this patch, I'm seeing lots of new errors and timeouts.
I have been ignoring regression reports for *san because of yyrandomness
in the results, but the timeouts are a  major inconvenience in testing
because it increases latency a lot in getting results, or worse I get no
result at all because the validation job is killed before completion.

Looking at some intermediate logs, I have noticed:
==24797==AddressSanitizer CHECK failed:
/libsanitizer/asan/asan_poisoning.cc:34
"((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
    #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
    #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
/libsanitizer/sanitizer_common/sanitizer_termination.cc:77
    #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
    #3 0x4085409b in __asan_register_globals
/libsanitizer/asan/asan_globals.cc:368
    #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
(/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)

in MANY (193 in gcc) tests.

and many others (152 in gcc) just time out individually (eg
c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
the logs besides Dejagnu's
WARNING: program timed out.


Since I'm using an apparently unusual setup, maybe I have to update it
to cope with the new version,
so I'd like to know if others are seeing the same problems on arm?

I'm using qemu -R 0 to execute the test programs, encapsulated by
proot (similar to chroot, but does not require root privileges).

Am I missing something obvious?

Thanks,

Christophe


>> 1) We have a bunch of GCC local patches, did you include them into a
>> cumulative patch (I guess yes)?
>
> I have done some verification today, diff from upstream r285547 to unpatched
> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
> and diff from upstream r315899 to patched GCC (again, two liners removed),
> attached P2 and went through the changes in P1 and verified that except for
> the ubsan backwards compatibility we had that can't work anymore everything
> else was upstreamed, or remained in P2.  So P2 is the current diff from
> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
> changes now filed upstream.
>
>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>> GCC too?
>
> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
> out of liblsan and link it into executables, will handle it next (there is a
> PR about it, just wanted to wait until the merge is in).
>
>         Jakub
Maxim Ostapenko Oct. 30, 2017, 10:12 a.m. UTC | #10
Hi,

sorry for the late response.

On 20/10/17 13:45, Christophe Lyon wrote:
> Hi,
>
> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>> Is the patch (the merge + this incremental) ok for trunk?
>>> I think the patch is OK, just wondering about two things:
>> Richi just approved the patch on IRC, so I'll commit, then we can deal with
>> follow-ups.
>>
> Does anyone else run these tests on arm?
> Since you applied this patch, I'm seeing lots of new errors and timeouts.
> I have been ignoring regression reports for *san because of yyrandomness
> in the results, but the timeouts are a  major inconvenience in testing
> because it increases latency a lot in getting results, or worse I get no
> result at all because the validation job is killed before completion.
>
> Looking at some intermediate logs, I have noticed:
> ==24797==AddressSanitizer CHECK failed:
> /libsanitizer/asan/asan_poisoning.cc:34
> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
> const*, unsigned long long, unsigned long long)
> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>      #3 0x4085409b in __asan_register_globals
> /libsanitizer/asan/asan_globals.cc:368
>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>
> in MANY (193 in gcc) tests.
>
> and many others (152 in gcc) just time out individually (eg
> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
> the logs besides Dejagnu's
> WARNING: program timed out.
>
>
> Since I'm using an apparently unusual setup, maybe I have to update it
> to cope with the new version,
> so I'd like to know if others are seeing the same problems on arm?
>
> I'm using qemu -R 0 to execute the test programs, encapsulated by
> proot (similar to chroot, but does not require root privileges).
>
> Am I missing something obvious?

I've caught the same error on my Arndale board. The issue seems to be 
quite obvious: after merge, ASan requires globals array to be aligned by 
shadow granularity.
This trivial patch seems to fix the issue. Could you check it on your setup?

Thanks,
-Maxim

>
> Thanks,
>
> Christophe
>
>
>>> 1) We have a bunch of GCC local patches, did you include them into a
>>> cumulative patch (I guess yes)?
>> I have done some verification today, diff from upstream r285547 to unpatched
>> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
>> and diff from upstream r315899 to patched GCC (again, two liners removed),
>> attached P2 and went through the changes in P1 and verified that except for
>> the ubsan backwards compatibility we had that can't work anymore everything
>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>> changes now filed upstream.
>>
>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>>> GCC too?
>> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
>> out of liblsan and link it into executables, will handle it next (there is a
>> PR about it, just wanted to wait until the merge is in).
>>
>>          Jakub
>
>
gcc/ChangeLog:

2017-10-30  Maxim Ostapenko  <m.ostapenko@samsung.com>

	* asan.c (asan_finish_file): Align asan globals array by shadow
	granularity.

diff --git a/gcc/asan.c b/gcc/asan.c
index 302ac4f..d5128aa 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2942,6 +2942,9 @@ asan_finish_file (void)
       TREE_CONSTANT (ctor) = 1;
       TREE_STATIC (ctor) = 1;
       DECL_INITIAL (var) = ctor;
+      SET_DECL_ALIGN (var, MAX (DECL_ALIGN (var),
+				ASAN_SHADOW_GRANULARITY * BITS_PER_UNIT));
+
       varpool_node::finalize_decl (var);
 
       tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);
Jakub Jelinek Oct. 30, 2017, 10:17 a.m. UTC | #11
On Mon, Oct 30, 2017 at 01:12:47PM +0300, Maxim Ostapenko wrote:
> I've caught the same error on my Arndale board. The issue seems to be quite
> obvious: after merge, ASan requires globals array to be aligned by shadow
> granularity.
> This trivial patch seems to fix the issue. Could you check it on your setup?

Indeed, it now wants to poison the arrays after the registration is over.

> 2017-10-30  Maxim Ostapenko  <m.ostapenko@samsung.com>
> 
> 	* asan.c (asan_finish_file): Align asan globals array by shadow
> 	granularity.

Ok, thanks.

BTW, we should investigate the __asan_register_elf_globals/__asan_unregister_elf_globals
and whether it is something we should start using too.

> diff --git a/gcc/asan.c b/gcc/asan.c
> index 302ac4f..d5128aa 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -2942,6 +2942,9 @@ asan_finish_file (void)
>        TREE_CONSTANT (ctor) = 1;
>        TREE_STATIC (ctor) = 1;
>        DECL_INITIAL (var) = ctor;
> +      SET_DECL_ALIGN (var, MAX (DECL_ALIGN (var),
> +				ASAN_SHADOW_GRANULARITY * BITS_PER_UNIT));
> +
>        varpool_node::finalize_decl (var);
>  
>        tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS);


	Jakub
Christophe Lyon Oct. 30, 2017, 2:08 p.m. UTC | #12
On 30/10/2017 11:12, Maxim Ostapenko wrote:
> Hi,
> 
> sorry for the late response.
> 
> On 20/10/17 13:45, Christophe Lyon wrote:
>> Hi,
>>
>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>> I think the patch is OK, just wondering about two things:
>>> Richi just approved the patch on IRC, so I'll commit, then we can deal with
>>> follow-ups.
>>>
>> Does anyone else run these tests on arm?
>> Since you applied this patch, I'm seeing lots of new errors and timeouts.
>> I have been ignoring regression reports for *san because of yyrandomness
>> in the results, but the timeouts are a  major inconvenience in testing
>> because it increases latency a lot in getting results, or worse I get no
>> result at all because the validation job is killed before completion.
>>
>> Looking at some intermediate logs, I have noticed:
>> ==24797==AddressSanitizer CHECK failed:
>> /libsanitizer/asan/asan_poisoning.cc:34
>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>> const*, unsigned long long, unsigned long long)
>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>      #3 0x4085409b in __asan_register_globals
>> /libsanitizer/asan/asan_globals.cc:368
>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>
>> in MANY (193 in gcc) tests.
>>
>> and many others (152 in gcc) just time out individually (eg
>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>> the logs besides Dejagnu's
>> WARNING: program timed out.
>>
>>
>> Since I'm using an apparently unusual setup, maybe I have to update it
>> to cope with the new version,
>> so I'd like to know if others are seeing the same problems on arm?
>>
>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>> proot (similar to chroot, but does not require root privileges).
>>
>> Am I missing something obvious?
> 
> I've caught the same error on my Arndale board. The issue seems to be quite obvious: after merge, ASan requires globals array to be aligned by shadow granularity.

Thanks for confirming. I've spent a lot of time investigating the timeout issues, that led to zombie processes and servers needing reboot. I've finally identified that going back to qemu-2.7 avoid the timeout issues (I've reported a qemu bug).

> This trivial patch seems to fix the issue. Could you check it on your setup?
> 
I was just about to finally start looking at this sanity check problem, so thank you very much for sharing your patch.
I manually tested it on the subset of my configs and it solves the assertion failure, thanks!
However, I can notice many regressions compared to before the merge:
c-c++-common/asan/alloca_instruments_all_paddings.c
c-c++-common/asan/alloca_loop_unpoisoning.c
c-c++-common/asan/alloca_safe_access.c
c-c++-common/asan/asan-interface-1.c
c-c++-common/asan/halt_on_error-1.c
c-c++-common/asan/pr59063-1.c
c-c++-common/asan/pr59063-2.c
c-c++-common/asan/pr63316.c
c-c++-common/asan/pr63888.c
c-c++-common/asan/pr70712.c
c-c++-common/asan/pr71480.c
c-c++-common/asan/pr79944.c
c-c++-common/asan/pr80308.c
c-c++-common/asan/swapcontext-test-1.c
gcc.dg/asan/nosanitize-and-inline.c
gcc.dg/asan/pr79196.c
gcc.dg/asan/pr80166.c
gcc.dg/asan/pr81186.c
gcc.dg/asan/use-after-scope-11.c
gcc.dg/asan/use-after-scope-4.c
gcc.dg/asan/use-after-scope-6.c
gcc.dg/asan/use-after-scope-7.c
gcc.dg/asan/use-after-scope-goto-1.c
gcc.dg/asan/use-after-scope-goto-2.c
gcc.dg/asan/use-after-scope-switch-1.c
gcc.dg/asan/use-after-scope-switch-2.c
gcc.dg/asan/use-after-scope-switch-3.c
gcc.dg/asan/use-after-scope-switch-4.c

out of which only
c-c++-common/asan/swapcontext-test-1.c
c-c++-common/asan/halt_on_error-1.c
print something in gcc.log

Do they pass for you?

Thanks,

Christophe

> Thanks,
> -Maxim
> 
>>
>> Thanks,
>>
>> Christophe
>>
>>
>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>> cumulative patch (I guess yes)?
>>> I have done some verification today, diff from upstream r285547 to unpatched
>>> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
>>> and diff from upstream r315899 to patched GCC (again, two liners removed),
>>> attached P2 and went through the changes in P1 and verified that except for
>>> the ubsan backwards compatibility we had that can't work anymore everything
>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>> changes now filed upstream.
>>>
>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>>>> GCC too?
>>> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
>>> out of liblsan and link it into executables, will handle it next (there is a
>>> PR about it, just wanted to wait until the merge is in).
>>>
>>>          Jakub
>>
>>
>
Maxim Ostapenko Oct. 30, 2017, 3:21 p.m. UTC | #13
On 30/10/17 17:08, Christophe Lyon wrote:
> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>> Hi,
>>
>> sorry for the late response.
>>
>> On 20/10/17 13:45, Christophe Lyon wrote:
>>> Hi,
>>>
>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>> I think the patch is OK, just wondering about two things:
>>>> Richi just approved the patch on IRC, so I'll commit, then we can 
>>>> deal with
>>>> follow-ups.
>>>>
>>> Does anyone else run these tests on arm?
>>> Since you applied this patch, I'm seeing lots of new errors and 
>>> timeouts.
>>> I have been ignoring regression reports for *san because of 
>>> yyrandomness
>>> in the results, but the timeouts are a  major inconvenience in testing
>>> because it increases latency a lot in getting results, or worse I 
>>> get no
>>> result at all because the validation job is killed before completion.
>>>
>>> Looking at some intermediate logs, I have noticed:
>>> ==24797==AddressSanitizer CHECK failed:
>>> /libsanitizer/asan/asan_poisoning.cc:34
>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>> const*, unsigned long long, unsigned long long)
>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>      #3 0x4085409b in __asan_register_globals
>>> /libsanitizer/asan/asan_globals.cc:368
>>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb) 
>>>
>>>
>>> in MANY (193 in gcc) tests.
>>>
>>> and many others (152 in gcc) just time out individually (eg
>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>> the logs besides Dejagnu's
>>> WARNING: program timed out.
>>>
>>>
>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>> to cope with the new version,
>>> so I'd like to know if others are seeing the same problems on arm?
>>>
>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>> proot (similar to chroot, but does not require root privileges).
>>>
>>> Am I missing something obvious?
>>
>> I've caught the same error on my Arndale board. The issue seems to be 
>> quite obvious: after merge, ASan requires globals array to be aligned 
>> by shadow granularity.
>
> Thanks for confirming. I've spent a lot of time investigating the 
> timeout issues, that led to zombie processes and servers needing 
> reboot. I've finally identified that going back to qemu-2.7 avoid the 
> timeout issues (I've reported a qemu bug).
>
>> This trivial patch seems to fix the issue. Could you check it on your 
>> setup?
>>
> I was just about to finally start looking at this sanity check 
> problem, so thank you very much for sharing your patch.
> I manually tested it on the subset of my configs and it solves the 
> assertion failure, thanks!
> However, I can notice many regressions compared to before the merge:
> c-c++-common/asan/alloca_instruments_all_paddings.c
> c-c++-common/asan/alloca_loop_unpoisoning.c
> c-c++-common/asan/alloca_safe_access.c
> c-c++-common/asan/asan-interface-1.c
> c-c++-common/asan/halt_on_error-1.c
> c-c++-common/asan/pr59063-1.c
> c-c++-common/asan/pr59063-2.c
> c-c++-common/asan/pr63316.c
> c-c++-common/asan/pr63888.c
> c-c++-common/asan/pr70712.c
> c-c++-common/asan/pr71480.c
> c-c++-common/asan/pr79944.c
> c-c++-common/asan/pr80308.c
> c-c++-common/asan/swapcontext-test-1.c
> gcc.dg/asan/nosanitize-and-inline.c
> gcc.dg/asan/pr79196.c
> gcc.dg/asan/pr80166.c
> gcc.dg/asan/pr81186.c
> gcc.dg/asan/use-after-scope-11.c
> gcc.dg/asan/use-after-scope-4.c
> gcc.dg/asan/use-after-scope-6.c
> gcc.dg/asan/use-after-scope-7.c
> gcc.dg/asan/use-after-scope-goto-1.c
> gcc.dg/asan/use-after-scope-goto-2.c
> gcc.dg/asan/use-after-scope-switch-1.c
> gcc.dg/asan/use-after-scope-switch-2.c
> gcc.dg/asan/use-after-scope-switch-3.c
> gcc.dg/asan/use-after-scope-switch-4.c
>
> out of which only
> c-c++-common/asan/swapcontext-test-1.c
> c-c++-common/asan/halt_on_error-1.c
> print something in gcc.log
>
> Do they pass for you?

Ah, I see. The problem is that after this merge LSan was enabled for 
ARM. LSan sets atexit handler that calls internal_clone function that's 
not supported in QEMU.
That's why these tests pass on board, but fail under QEMU.
Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?

-Maxim

>
> Thanks,
>
> Christophe
>
>> Thanks,
>> -Maxim
>>
>>>
>>> Thanks,
>>>
>>> Christophe
>>>
>>>
>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>> cumulative patch (I guess yes)?
>>>> I have done some verification today, diff from upstream r285547 to 
>>>> unpatched
>>>> GCC (with the LLVM Compiler infrastructure two liners removed), 
>>>> attached P1,
>>>> and diff from upstream r315899 to patched GCC (again, two liners 
>>>> removed),
>>>> attached P2 and went through the changes in P1 and verified that 
>>>> except for
>>>> the ubsan backwards compatibility we had that can't work anymore 
>>>> everything
>>>> else was upstreamed, or remained in P2.  So P2 is the current diff 
>>>> from
>>>> upstream, with the 
>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>> changes now filed upstream.
>>>>
>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to 
>>>>> enable them in
>>>>> GCC too?
>>>> Maybe, feel free to post patches.  For LSan we need to split off 
>>>> lsan_preinit
>>>> out of liblsan and link it into executables, will handle it next 
>>>> (there is a
>>>> PR about it, just wanted to wait until the merge is in).
>>>>
>>>>          Jakub
>>>
>>>
>>
>
>
>
>
Christophe Lyon Oct. 30, 2017, 3:46 p.m. UTC | #14
On 30/10/2017 16:21, Maxim Ostapenko wrote:
> On 30/10/17 17:08, Christophe Lyon wrote:
>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>> Hi,
>>>
>>> sorry for the late response.
>>>
>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>> Hi,
>>>>
>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>> I think the patch is OK, just wondering about two things:
>>>>> Richi just approved the patch on IRC, so I'll commit, then we can deal with
>>>>> follow-ups.
>>>>>
>>>> Does anyone else run these tests on arm?
>>>> Since you applied this patch, I'm seeing lots of new errors and timeouts.
>>>> I have been ignoring regression reports for *san because of yyrandomness
>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>> because it increases latency a lot in getting results, or worse I get no
>>>> result at all because the validation job is killed before completion.
>>>>
>>>> Looking at some intermediate logs, I have noticed:
>>>> ==24797==AddressSanitizer CHECK failed:
>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>> const*, unsigned long long, unsigned long long)
>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>      #3 0x4085409b in __asan_register_globals
>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>
>>>> in MANY (193 in gcc) tests.
>>>>
>>>> and many others (152 in gcc) just time out individually (eg
>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>> the logs besides Dejagnu's
>>>> WARNING: program timed out.
>>>>
>>>>
>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>> to cope with the new version,
>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>
>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>> proot (similar to chroot, but does not require root privileges).
>>>>
>>>> Am I missing something obvious?
>>>
>>> I've caught the same error on my Arndale board. The issue seems to be quite obvious: after merge, ASan requires globals array to be aligned by shadow granularity.
>>
>> Thanks for confirming. I've spent a lot of time investigating the timeout issues, that led to zombie processes and servers needing reboot. I've finally identified that going back to qemu-2.7 avoid the timeout issues (I've reported a qemu bug).
>>
>>> This trivial patch seems to fix the issue. Could you check it on your setup?
>>>
>> I was just about to finally start looking at this sanity check problem, so thank you very much for sharing your patch.
>> I manually tested it on the subset of my configs and it solves the assertion failure, thanks!
>> However, I can notice many regressions compared to before the merge:
>> c-c++-common/asan/alloca_instruments_all_paddings.c
>> c-c++-common/asan/alloca_loop_unpoisoning.c
>> c-c++-common/asan/alloca_safe_access.c
>> c-c++-common/asan/asan-interface-1.c
>> c-c++-common/asan/halt_on_error-1.c
>> c-c++-common/asan/pr59063-1.c
>> c-c++-common/asan/pr59063-2.c
>> c-c++-common/asan/pr63316.c
>> c-c++-common/asan/pr63888.c
>> c-c++-common/asan/pr70712.c
>> c-c++-common/asan/pr71480.c
>> c-c++-common/asan/pr79944.c
>> c-c++-common/asan/pr80308.c
>> c-c++-common/asan/swapcontext-test-1.c
>> gcc.dg/asan/nosanitize-and-inline.c
>> gcc.dg/asan/pr79196.c
>> gcc.dg/asan/pr80166.c
>> gcc.dg/asan/pr81186.c
>> gcc.dg/asan/use-after-scope-11.c
>> gcc.dg/asan/use-after-scope-4.c
>> gcc.dg/asan/use-after-scope-6.c
>> gcc.dg/asan/use-after-scope-7.c
>> gcc.dg/asan/use-after-scope-goto-1.c
>> gcc.dg/asan/use-after-scope-goto-2.c
>> gcc.dg/asan/use-after-scope-switch-1.c
>> gcc.dg/asan/use-after-scope-switch-2.c
>> gcc.dg/asan/use-after-scope-switch-3.c
>> gcc.dg/asan/use-after-scope-switch-4.c
>>
>> out of which only
>> c-c++-common/asan/swapcontext-test-1.c
>> c-c++-common/asan/halt_on_error-1.c
>> print something in gcc.log
>>
>> Do they pass for you?
> 
> Ah, I see. The problem is that after this merge LSan was enabled for ARM. LSan sets atexit handler that calls internal_clone function that's not supported in QEMU.
> That's why these tests pass on board, but fail under QEMU.
> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
> 

Ha, thanks it works!

The remaining failure is on c-c++-common/asan/halt_on_error-1.c, which seems to dump the expected messages, but exits with return code=4.

Any idea ?

Thanks,

Christophe

> -Maxim
> 
>>
>> Thanks,
>>
>> Christophe
>>
>>> Thanks,
>>> -Maxim
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Christophe
>>>>
>>>>
>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>> cumulative patch (I guess yes)?
>>>>> I have done some verification today, diff from upstream r285547 to unpatched
>>>>> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
>>>>> and diff from upstream r315899 to patched GCC (again, two liners removed),
>>>>> attached P2 and went through the changes in P1 and verified that except for
>>>>> the ubsan backwards compatibility we had that can't work anymore everything
>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>>>> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>> changes now filed upstream.
>>>>>
>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>>>>>> GCC too?
>>>>> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
>>>>> out of liblsan and link it into executables, will handle it next (there is a
>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>
>>>>>          Jakub
>>>>
>>>>
>>>
>>
>>
>>
>>
> 
> .
>
Maxim Ostapenko Oct. 30, 2017, 3:54 p.m. UTC | #15
On 30/10/17 18:46, Christophe Lyon wrote:
> On 30/10/2017 16:21, Maxim Ostapenko wrote:
>> On 30/10/17 17:08, Christophe Lyon wrote:
>>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>> Hi,
>>>>
>>>> sorry for the late response.
>>>>
>>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>> Hi,
>>>>>
>>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>> I think the patch is OK, just wondering about two things:
>>>>>> Richi just approved the patch on IRC, so I'll commit, then we can 
>>>>>> deal with
>>>>>> follow-ups.
>>>>>>
>>>>> Does anyone else run these tests on arm?
>>>>> Since you applied this patch, I'm seeing lots of new errors and 
>>>>> timeouts.
>>>>> I have been ignoring regression reports for *san because of 
>>>>> yyrandomness
>>>>> in the results, but the timeouts are a  major inconvenience in 
>>>>> testing
>>>>> because it increases latency a lot in getting results, or worse I 
>>>>> get no
>>>>> result at all because the validation job is killed before completion.
>>>>>
>>>>> Looking at some intermediate logs, I have noticed:
>>>>> ==24797==AddressSanitizer CHECK failed:
>>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>>      #0 0x408d7d65 in AsanCheckFailed 
>>>>> /libsanitizer/asan/asan_rtl.cc:67
>>>>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>>> const*, unsigned long long, unsigned long long)
>>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>>      #3 0x4085409b in __asan_register_globals
>>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb) 
>>>>>
>>>>>
>>>>> in MANY (193 in gcc) tests.
>>>>>
>>>>> and many others (152 in gcc) just time out individually (eg
>>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>>> the logs besides Dejagnu's
>>>>> WARNING: program timed out.
>>>>>
>>>>>
>>>>> Since I'm using an apparently unusual setup, maybe I have to 
>>>>> update it
>>>>> to cope with the new version,
>>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>>
>>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>>> proot (similar to chroot, but does not require root privileges).
>>>>>
>>>>> Am I missing something obvious?
>>>>
>>>> I've caught the same error on my Arndale board. The issue seems to 
>>>> be quite obvious: after merge, ASan requires globals array to be 
>>>> aligned by shadow granularity.
>>>
>>> Thanks for confirming. I've spent a lot of time investigating the 
>>> timeout issues, that led to zombie processes and servers needing 
>>> reboot. I've finally identified that going back to qemu-2.7 avoid 
>>> the timeout issues (I've reported a qemu bug).
>>>
>>>> This trivial patch seems to fix the issue. Could you check it on 
>>>> your setup?
>>>>
>>> I was just about to finally start looking at this sanity check 
>>> problem, so thank you very much for sharing your patch.
>>> I manually tested it on the subset of my configs and it solves the 
>>> assertion failure, thanks!
>>> However, I can notice many regressions compared to before the merge:
>>> c-c++-common/asan/alloca_instruments_all_paddings.c
>>> c-c++-common/asan/alloca_loop_unpoisoning.c
>>> c-c++-common/asan/alloca_safe_access.c
>>> c-c++-common/asan/asan-interface-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> c-c++-common/asan/pr59063-1.c
>>> c-c++-common/asan/pr59063-2.c
>>> c-c++-common/asan/pr63316.c
>>> c-c++-common/asan/pr63888.c
>>> c-c++-common/asan/pr70712.c
>>> c-c++-common/asan/pr71480.c
>>> c-c++-common/asan/pr79944.c
>>> c-c++-common/asan/pr80308.c
>>> c-c++-common/asan/swapcontext-test-1.c
>>> gcc.dg/asan/nosanitize-and-inline.c
>>> gcc.dg/asan/pr79196.c
>>> gcc.dg/asan/pr80166.c
>>> gcc.dg/asan/pr81186.c
>>> gcc.dg/asan/use-after-scope-11.c
>>> gcc.dg/asan/use-after-scope-4.c
>>> gcc.dg/asan/use-after-scope-6.c
>>> gcc.dg/asan/use-after-scope-7.c
>>> gcc.dg/asan/use-after-scope-goto-1.c
>>> gcc.dg/asan/use-after-scope-goto-2.c
>>> gcc.dg/asan/use-after-scope-switch-1.c
>>> gcc.dg/asan/use-after-scope-switch-2.c
>>> gcc.dg/asan/use-after-scope-switch-3.c
>>> gcc.dg/asan/use-after-scope-switch-4.c
>>>
>>> out of which only
>>> c-c++-common/asan/swapcontext-test-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> print something in gcc.log
>>>
>>> Do they pass for you?
>>
>> Ah, I see. The problem is that after this merge LSan was enabled for 
>> ARM. LSan sets atexit handler that calls internal_clone function 
>> that's not supported in QEMU.
>> That's why these tests pass on board, but fail under QEMU.
>> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>>
>
> Ha, thanks it works!
>
> The remaining failure is on c-c++-common/asan/halt_on_error-1.c, which 
> seems to dump the expected messages, but exits with return code=4.

Same here, halt_on_error-1.c just overwrites ASAN_OPTIONS via 
"halt_on_error=false" thus enabling LSan back.
Something like this (attached) should work.

-Maxim

>
> Any idea ?
>
> Thanks,
>
> Christophe
>
>> -Maxim
>>
>>>
>>> Thanks,
>>>
>>> Christophe
>>>
>>>> Thanks,
>>>> -Maxim
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Christophe
>>>>>
>>>>>
>>>>>>> 1) We have a bunch of GCC local patches, did you include them 
>>>>>>> into a
>>>>>>> cumulative patch (I guess yes)?
>>>>>> I have done some verification today, diff from upstream r285547 
>>>>>> to unpatched
>>>>>> GCC (with the LLVM Compiler infrastructure two liners removed), 
>>>>>> attached P1,
>>>>>> and diff from upstream r315899 to patched GCC (again, two liners 
>>>>>> removed),
>>>>>> attached P2 and went through the changes in P1 and verified that 
>>>>>> except for
>>>>>> the ubsan backwards compatibility we had that can't work anymore 
>>>>>> everything
>>>>>> else was upstreamed, or remained in P2.  So P2 is the current 
>>>>>> diff from
>>>>>> upstream, with the 
>>>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>>> changes now filed upstream.
>>>>>>
>>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to 
>>>>>>> enable them in
>>>>>>> GCC too?
>>>>>> Maybe, feel free to post patches.  For LSan we need to split off 
>>>>>> lsan_preinit
>>>>>> out of liblsan and link it into executables, will handle it next 
>>>>>> (there is a
>>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>>
>>>>>>          Jakub
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>> .
>>
>
>
>
>
diff --git a/gcc/testsuite/c-c++-common/asan/halt_on_error-1.c b/gcc/testsuite/c-c++-common/asan/halt_on_error-1.c
index 52e705d..ae55dea 100644
--- a/gcc/testsuite/c-c++-common/asan/halt_on_error-1.c
+++ b/gcc/testsuite/c-c++-common/asan/halt_on_error-1.c
@@ -1,7 +1,7 @@
 /* Test recovery mode.  */
 /* { dg-do run } */
 /* { dg-options "-fsanitize-recover=address" } */
-/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=false" } */
+/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=false:detect_leaks=0" } */
 
 #include <string.h>
Christophe Lyon Oct. 30, 2017, 4:09 p.m. UTC | #16
On 30/10/2017 16:54, Maxim Ostapenko wrote:
> On 30/10/17 18:46, Christophe Lyon wrote:
>> On 30/10/2017 16:21, Maxim Ostapenko wrote:
>>> On 30/10/17 17:08, Christophe Lyon wrote:
>>>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>>> Hi,
>>>>>
>>>>> sorry for the late response.
>>>>>
>>>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>>> I think the patch is OK, just wondering about two things:
>>>>>>> Richi just approved the patch on IRC, so I'll commit, then we can deal with
>>>>>>> follow-ups.
>>>>>>>
>>>>>> Does anyone else run these tests on arm?
>>>>>> Since you applied this patch, I'm seeing lots of new errors and timeouts.
>>>>>> I have been ignoring regression reports for *san because of yyrandomness
>>>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>>>> because it increases latency a lot in getting results, or worse I get no
>>>>>> result at all because the validation job is killed before completion.
>>>>>>
>>>>>> Looking at some intermediate logs, I have noticed:
>>>>>> ==24797==AddressSanitizer CHECK failed:
>>>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>>>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>>>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>>>> const*, unsigned long long, unsigned long long)
>>>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>>>      #3 0x4085409b in __asan_register_globals
>>>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>>>
>>>>>> in MANY (193 in gcc) tests.
>>>>>>
>>>>>> and many others (152 in gcc) just time out individually (eg
>>>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>>>> the logs besides Dejagnu's
>>>>>> WARNING: program timed out.
>>>>>>
>>>>>>
>>>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>>>> to cope with the new version,
>>>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>>>
>>>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>>>> proot (similar to chroot, but does not require root privileges).
>>>>>>
>>>>>> Am I missing something obvious?
>>>>>
>>>>> I've caught the same error on my Arndale board. The issue seems to be quite obvious: after merge, ASan requires globals array to be aligned by shadow granularity.
>>>>
>>>> Thanks for confirming. I've spent a lot of time investigating the timeout issues, that led to zombie processes and servers needing reboot. I've finally identified that going back to qemu-2.7 avoid the timeout issues (I've reported a qemu bug).
>>>>
>>>>> This trivial patch seems to fix the issue. Could you check it on your setup?
>>>>>
>>>> I was just about to finally start looking at this sanity check problem, so thank you very much for sharing your patch.
>>>> I manually tested it on the subset of my configs and it solves the assertion failure, thanks!
>>>> However, I can notice many regressions compared to before the merge:
>>>> c-c++-common/asan/alloca_instruments_all_paddings.c
>>>> c-c++-common/asan/alloca_loop_unpoisoning.c
>>>> c-c++-common/asan/alloca_safe_access.c
>>>> c-c++-common/asan/asan-interface-1.c
>>>> c-c++-common/asan/halt_on_error-1.c
>>>> c-c++-common/asan/pr59063-1.c
>>>> c-c++-common/asan/pr59063-2.c
>>>> c-c++-common/asan/pr63316.c
>>>> c-c++-common/asan/pr63888.c
>>>> c-c++-common/asan/pr70712.c
>>>> c-c++-common/asan/pr71480.c
>>>> c-c++-common/asan/pr79944.c
>>>> c-c++-common/asan/pr80308.c
>>>> c-c++-common/asan/swapcontext-test-1.c
>>>> gcc.dg/asan/nosanitize-and-inline.c
>>>> gcc.dg/asan/pr79196.c
>>>> gcc.dg/asan/pr80166.c
>>>> gcc.dg/asan/pr81186.c
>>>> gcc.dg/asan/use-after-scope-11.c
>>>> gcc.dg/asan/use-after-scope-4.c
>>>> gcc.dg/asan/use-after-scope-6.c
>>>> gcc.dg/asan/use-after-scope-7.c
>>>> gcc.dg/asan/use-after-scope-goto-1.c
>>>> gcc.dg/asan/use-after-scope-goto-2.c
>>>> gcc.dg/asan/use-after-scope-switch-1.c
>>>> gcc.dg/asan/use-after-scope-switch-2.c
>>>> gcc.dg/asan/use-after-scope-switch-3.c
>>>> gcc.dg/asan/use-after-scope-switch-4.c
>>>>
>>>> out of which only
>>>> c-c++-common/asan/swapcontext-test-1.c
>>>> c-c++-common/asan/halt_on_error-1.c
>>>> print something in gcc.log
>>>>
>>>> Do they pass for you?
>>>
>>> Ah, I see. The problem is that after this merge LSan was enabled for ARM. LSan sets atexit handler that calls internal_clone function that's not supported in QEMU.
>>> That's why these tests pass on board, but fail under QEMU.
>>> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>>>
>>
>> Ha, thanks it works!
>>
>> The remaining failure is on c-c++-common/asan/halt_on_error-1.c, which seems to dump the expected messages, but exits with return code=4.
> 
> Same here, halt_on_error-1.c just overwrites ASAN_OPTIONS via "halt_on_error=false" thus enabling LSan back.
> Something like this (attached) should work.
> 

Indeed, thanks a lot!

It looks like I'm going to have to apply local patches such as this one if I want to continue to be able to run validations using QEMU. I'm not a big fan of such local patches that will sure enough prove fragile at some point. Since I'm mainly tracking regressions, I may just leave this test failing (as in known-failure).

Thanks,

Christophe

> -Maxim
> 
>>
>> Any idea ?
>>
>> Thanks,
>>
>> Christophe
>>
>>> -Maxim
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Christophe
>>>>
>>>>> Thanks,
>>>>> -Maxim
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Christophe
>>>>>>
>>>>>>
>>>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>>>> cumulative patch (I guess yes)?
>>>>>>> I have done some verification today, diff from upstream r285547 to unpatched
>>>>>>> GCC (with the LLVM Compiler infrastructure two liners removed), attached P1,
>>>>>>> and diff from upstream r315899 to patched GCC (again, two liners removed),
>>>>>>> attached P2 and went through the changes in P1 and verified that except for
>>>>>>> the ubsan backwards compatibility we had that can't work anymore everything
>>>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>>>>>> upstream, with the sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>>>> changes now filed upstream.
>>>>>>>
>>>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable them in
>>>>>>>> GCC too?
>>>>>>> Maybe, feel free to post patches.  For LSan we need to split off lsan_preinit
>>>>>>> out of liblsan and link it into executables, will handle it next (there is a
>>>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>>>
>>>>>>>          Jakub
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> .
>>>
>>
>>
>>
>>
>
Christophe Lyon Nov. 13, 2017, 12:47 p.m. UTC | #17
On 30 October 2017 at 16:21, Maxim Ostapenko <m.ostapenko@samsung.com> wrote:
> On 30/10/17 17:08, Christophe Lyon wrote:
>>
>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>
>>> Hi,
>>>
>>> sorry for the late response.
>>>
>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>
>>>> Hi,
>>>>
>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>
>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>
>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>
>>>>>> I think the patch is OK, just wondering about two things:
>>>>>
>>>>> Richi just approved the patch on IRC, so I'll commit, then we can deal
>>>>> with
>>>>> follow-ups.
>>>>>
>>>> Does anyone else run these tests on arm?
>>>> Since you applied this patch, I'm seeing lots of new errors and
>>>> timeouts.
>>>> I have been ignoring regression reports for *san because of yyrandomness
>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>> because it increases latency a lot in getting results, or worse I get no
>>>> result at all because the validation job is killed before completion.
>>>>
>>>> Looking at some intermediate logs, I have noticed:
>>>> ==24797==AddressSanitizer CHECK failed:
>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>      #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>>      #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>> const*, unsigned long long, unsigned long long)
>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>      #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>      #3 0x4085409b in __asan_register_globals
>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>      #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>
>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>
>>>> in MANY (193 in gcc) tests.
>>>>
>>>> and many others (152 in gcc) just time out individually (eg
>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>> the logs besides Dejagnu's
>>>> WARNING: program timed out.
>>>>
>>>>
>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>> to cope with the new version,
>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>
>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>> proot (similar to chroot, but does not require root privileges).
>>>>
>>>> Am I missing something obvious?
>>>
>>>
>>> I've caught the same error on my Arndale board. The issue seems to be
>>> quite obvious: after merge, ASan requires globals array to be aligned by
>>> shadow granularity.
>>
>>
>> Thanks for confirming. I've spent a lot of time investigating the timeout
>> issues, that led to zombie processes and servers needing reboot. I've
>> finally identified that going back to qemu-2.7 avoid the timeout issues
>> (I've reported a qemu bug).
>>
>>> This trivial patch seems to fix the issue. Could you check it on your
>>> setup?
>>>
>> I was just about to finally start looking at this sanity check problem, so
>> thank you very much for sharing your patch.
>> I manually tested it on the subset of my configs and it solves the
>> assertion failure, thanks!
>> However, I can notice many regressions compared to before the merge:
>> c-c++-common/asan/alloca_instruments_all_paddings.c
>> c-c++-common/asan/alloca_loop_unpoisoning.c
>> c-c++-common/asan/alloca_safe_access.c
>> c-c++-common/asan/asan-interface-1.c
>> c-c++-common/asan/halt_on_error-1.c
>> c-c++-common/asan/pr59063-1.c
>> c-c++-common/asan/pr59063-2.c
>> c-c++-common/asan/pr63316.c
>> c-c++-common/asan/pr63888.c
>> c-c++-common/asan/pr70712.c
>> c-c++-common/asan/pr71480.c
>> c-c++-common/asan/pr79944.c
>> c-c++-common/asan/pr80308.c
>> c-c++-common/asan/swapcontext-test-1.c
>> gcc.dg/asan/nosanitize-and-inline.c
>> gcc.dg/asan/pr79196.c
>> gcc.dg/asan/pr80166.c
>> gcc.dg/asan/pr81186.c
>> gcc.dg/asan/use-after-scope-11.c
>> gcc.dg/asan/use-after-scope-4.c
>> gcc.dg/asan/use-after-scope-6.c
>> gcc.dg/asan/use-after-scope-7.c
>> gcc.dg/asan/use-after-scope-goto-1.c
>> gcc.dg/asan/use-after-scope-goto-2.c
>> gcc.dg/asan/use-after-scope-switch-1.c
>> gcc.dg/asan/use-after-scope-switch-2.c
>> gcc.dg/asan/use-after-scope-switch-3.c
>> gcc.dg/asan/use-after-scope-switch-4.c
>>
>> out of which only
>> c-c++-common/asan/swapcontext-test-1.c
>> c-c++-common/asan/halt_on_error-1.c
>> print something in gcc.log
>>
>> Do they pass for you?
>
>
> Ah, I see. The problem is that after this merge LSan was enabled for ARM.
> LSan sets atexit handler that calls internal_clone function that's not
> supported in QEMU.
> That's why these tests pass on board, but fail under QEMU.
> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>

Hi,

I have a followup on this issue, after investigating a bit more.

I filed a bug report against QEMU, and indeed it seems that it rejects
clone() as called by the sanitizers on purpose, because it cannot support
CLONE_UNTRACED.

That being said, I was wondering why the same tests worked "better"
with qemu-aarch64 (as opposed to qemu-arm). And I noticed that on aarch64,
we have sanitizer_common/sanitizer_syscall_linux_aarch64.inc where
internal_iserror returns true if retval >= -4095.

On arm, we use sanitizer_common/sanitizer_syscall_generic.inc where
internal_iserror returns true if retval == -1.

But on the upstream sanitizer repo,
sanitizer_common/sanitizer_syscall_linux_arm.inc was added on Nov 8th,
and also checks for retval >= -4095, hence handling the clone() error
gracefully. So... can we merge again our sanitizer sources to at least
http://llvm.org/viewvc/llvm-project?view=revision&revision=317640 ?

Thanks,

Christophe


> -Maxim
>
>
>>
>> Thanks,
>>
>> Christophe
>>
>>> Thanks,
>>> -Maxim
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Christophe
>>>>
>>>>
>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>> cumulative patch (I guess yes)?
>>>>>
>>>>> I have done some verification today, diff from upstream r285547 to
>>>>> unpatched
>>>>> GCC (with the LLVM Compiler infrastructure two liners removed),
>>>>> attached P1,
>>>>> and diff from upstream r315899 to patched GCC (again, two liners
>>>>> removed),
>>>>> attached P2 and went through the changes in P1 and verified that except
>>>>> for
>>>>> the ubsan backwards compatibility we had that can't work anymore
>>>>> everything
>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>>>> upstream, with the
>>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>> changes now filed upstream.
>>>>>
>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable
>>>>>> them in
>>>>>> GCC too?
>>>>>
>>>>> Maybe, feel free to post patches.  For LSan we need to split off
>>>>> lsan_preinit
>>>>> out of liblsan and link it into executables, will handle it next (there
>>>>> is a
>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>
>>>>>          Jakub
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>>
>
Maxim Ostapenko Nov. 14, 2017, 3:40 p.m. UTC | #18
Hi,

On 13/11/17 15:47, Christophe Lyon wrote:
> On 30 October 2017 at 16:21, Maxim Ostapenko <m.ostapenko@samsung.com> wrote:
>> On 30/10/17 17:08, Christophe Lyon wrote:
>>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>> Hi,
>>>>
>>>> sorry for the late response.
>>>>
>>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>> Hi,
>>>>>
>>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>> I think the patch is OK, just wondering about two things:
>>>>>> Richi just approved the patch on IRC, so I'll commit, then we can deal
>>>>>> with
>>>>>> follow-ups.
>>>>>>
>>>>> Does anyone else run these tests on arm?
>>>>> Since you applied this patch, I'm seeing lots of new errors and
>>>>> timeouts.
>>>>> I have been ignoring regression reports for *san because of yyrandomness
>>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>>> because it increases latency a lot in getting results, or worse I get no
>>>>> result at all because the validation job is killed before completion.
>>>>>
>>>>> Looking at some intermediate logs, I have noticed:
>>>>> ==24797==AddressSanitizer CHECK failed:
>>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>>       #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>>>       #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>>> const*, unsigned long long, unsigned long long)
>>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>>       #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>>       #3 0x4085409b in __asan_register_globals
>>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>>       #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>>
>>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>>
>>>>> in MANY (193 in gcc) tests.
>>>>>
>>>>> and many others (152 in gcc) just time out individually (eg
>>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>>> the logs besides Dejagnu's
>>>>> WARNING: program timed out.
>>>>>
>>>>>
>>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>>> to cope with the new version,
>>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>>
>>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>>> proot (similar to chroot, but does not require root privileges).
>>>>>
>>>>> Am I missing something obvious?
>>>>
>>>> I've caught the same error on my Arndale board. The issue seems to be
>>>> quite obvious: after merge, ASan requires globals array to be aligned by
>>>> shadow granularity.
>>>
>>> Thanks for confirming. I've spent a lot of time investigating the timeout
>>> issues, that led to zombie processes and servers needing reboot. I've
>>> finally identified that going back to qemu-2.7 avoid the timeout issues
>>> (I've reported a qemu bug).
>>>
>>>> This trivial patch seems to fix the issue. Could you check it on your
>>>> setup?
>>>>
>>> I was just about to finally start looking at this sanity check problem, so
>>> thank you very much for sharing your patch.
>>> I manually tested it on the subset of my configs and it solves the
>>> assertion failure, thanks!
>>> However, I can notice many regressions compared to before the merge:
>>> c-c++-common/asan/alloca_instruments_all_paddings.c
>>> c-c++-common/asan/alloca_loop_unpoisoning.c
>>> c-c++-common/asan/alloca_safe_access.c
>>> c-c++-common/asan/asan-interface-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> c-c++-common/asan/pr59063-1.c
>>> c-c++-common/asan/pr59063-2.c
>>> c-c++-common/asan/pr63316.c
>>> c-c++-common/asan/pr63888.c
>>> c-c++-common/asan/pr70712.c
>>> c-c++-common/asan/pr71480.c
>>> c-c++-common/asan/pr79944.c
>>> c-c++-common/asan/pr80308.c
>>> c-c++-common/asan/swapcontext-test-1.c
>>> gcc.dg/asan/nosanitize-and-inline.c
>>> gcc.dg/asan/pr79196.c
>>> gcc.dg/asan/pr80166.c
>>> gcc.dg/asan/pr81186.c
>>> gcc.dg/asan/use-after-scope-11.c
>>> gcc.dg/asan/use-after-scope-4.c
>>> gcc.dg/asan/use-after-scope-6.c
>>> gcc.dg/asan/use-after-scope-7.c
>>> gcc.dg/asan/use-after-scope-goto-1.c
>>> gcc.dg/asan/use-after-scope-goto-2.c
>>> gcc.dg/asan/use-after-scope-switch-1.c
>>> gcc.dg/asan/use-after-scope-switch-2.c
>>> gcc.dg/asan/use-after-scope-switch-3.c
>>> gcc.dg/asan/use-after-scope-switch-4.c
>>>
>>> out of which only
>>> c-c++-common/asan/swapcontext-test-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> print something in gcc.log
>>>
>>> Do they pass for you?
>>
>> Ah, I see. The problem is that after this merge LSan was enabled for ARM.
>> LSan sets atexit handler that calls internal_clone function that's not
>> supported in QEMU.
>> That's why these tests pass on board, but fail under QEMU.
>> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>>
> Hi,
>
> I have a followup on this issue, after investigating a bit more.
>
> I filed a bug report against QEMU, and indeed it seems that it rejects
> clone() as called by the sanitizers on purpose, because it cannot support
> CLONE_UNTRACED.
>
> That being said, I was wondering why the same tests worked "better"
> with qemu-aarch64 (as opposed to qemu-arm). And I noticed that on aarch64,
> we have sanitizer_common/sanitizer_syscall_linux_aarch64.inc where
> internal_iserror returns true if retval >= -4095.
>
> On arm, we use sanitizer_common/sanitizer_syscall_generic.inc where
> internal_iserror returns true if retval == -1.
>
> But on the upstream sanitizer repo,
> sanitizer_common/sanitizer_syscall_linux_arm.inc was added on Nov 8th,
> and also checks for retval >= -4095, hence handling the clone() error
> gracefully. So... can we merge again our sanitizer sources to at least
> http://llvm.org/viewvc/llvm-project?view=revision&revision=317640 ?

I think we could just cherry-pick this commit from upstream. I can 
handle this if it's not too late given the fact that GCC is on stage 3 now.

-Maxim

>
> Thanks,
>
> Christophe
>
>
>> -Maxim
>>
>>
>>> Thanks,
>>>
>>> Christophe
>>>
>>>> Thanks,
>>>> -Maxim
>>>>
>>>>> Thanks,
>>>>>
>>>>> Christophe
>>>>>
>>>>>
>>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>>> cumulative patch (I guess yes)?
>>>>>> I have done some verification today, diff from upstream r285547 to
>>>>>> unpatched
>>>>>> GCC (with the LLVM Compiler infrastructure two liners removed),
>>>>>> attached P1,
>>>>>> and diff from upstream r315899 to patched GCC (again, two liners
>>>>>> removed),
>>>>>> attached P2 and went through the changes in P1 and verified that except
>>>>>> for
>>>>>> the ubsan backwards compatibility we had that can't work anymore
>>>>>> everything
>>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>>>>> upstream, with the
>>>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>>> changes now filed upstream.
>>>>>>
>>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable
>>>>>>> them in
>>>>>>> GCC too?
>>>>>> Maybe, feel free to post patches.  For LSan we need to split off
>>>>>> lsan_preinit
>>>>>> out of liblsan and link it into executables, will handle it next (there
>>>>>> is a
>>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>>
>>>>>>           Jakub
>>>>>
>>>>>
>>>
>>>
>>>
>
>
Jakub Jelinek Nov. 14, 2017, 3:49 p.m. UTC | #19
On Tue, Nov 14, 2017 at 06:40:32PM +0300, Maxim Ostapenko wrote:
> > But on the upstream sanitizer repo,
> > sanitizer_common/sanitizer_syscall_linux_arm.inc was added on Nov 8th,
> > and also checks for retval >= -4095, hence handling the clone() error
> > gracefully. So... can we merge again our sanitizer sources to at least
> > http://llvm.org/viewvc/llvm-project?view=revision&revision=317640 ?
> 
> I think we could just cherry-pick this commit from upstream. I can handle
> this if it's not too late given the fact that GCC is on stage 3 now.

stage3 starts only during the weekend.

	Jakub
Maxim Ostapenko Nov. 16, 2017, 12:25 p.m. UTC | #20
Hi Christophe,

On 13/11/17 15:47, Christophe Lyon wrote:
> On 30 October 2017 at 16:21, Maxim Ostapenko <m.ostapenko@samsung.com> wrote:
>> On 30/10/17 17:08, Christophe Lyon wrote:
>>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>> Hi,
>>>>
>>>> sorry for the late response.
>>>>
>>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>> Hi,
>>>>>
>>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>> I think the patch is OK, just wondering about two things:
>>>>>> Richi just approved the patch on IRC, so I'll commit, then we can deal
>>>>>> with
>>>>>> follow-ups.
>>>>>>
>>>>> Does anyone else run these tests on arm?
>>>>> Since you applied this patch, I'm seeing lots of new errors and
>>>>> timeouts.
>>>>> I have been ignoring regression reports for *san because of yyrandomness
>>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>>> because it increases latency a lot in getting results, or worse I get no
>>>>> result at all because the validation job is killed before completion.
>>>>>
>>>>> Looking at some intermediate logs, I have noticed:
>>>>> ==24797==AddressSanitizer CHECK failed:
>>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>>       #0 0x408d7d65 in AsanCheckFailed /libsanitizer/asan/asan_rtl.cc:67
>>>>>       #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>>> const*, unsigned long long, unsigned long long)
>>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>>       #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>>       #3 0x4085409b in __asan_register_globals
>>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>>       #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>>
>>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>>
>>>>> in MANY (193 in gcc) tests.
>>>>>
>>>>> and many others (152 in gcc) just time out individually (eg
>>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>>> the logs besides Dejagnu's
>>>>> WARNING: program timed out.
>>>>>
>>>>>
>>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>>> to cope with the new version,
>>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>>
>>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>>> proot (similar to chroot, but does not require root privileges).
>>>>>
>>>>> Am I missing something obvious?
>>>>
>>>> I've caught the same error on my Arndale board. The issue seems to be
>>>> quite obvious: after merge, ASan requires globals array to be aligned by
>>>> shadow granularity.
>>>
>>> Thanks for confirming. I've spent a lot of time investigating the timeout
>>> issues, that led to zombie processes and servers needing reboot. I've
>>> finally identified that going back to qemu-2.7 avoid the timeout issues
>>> (I've reported a qemu bug).
>>>
>>>> This trivial patch seems to fix the issue. Could you check it on your
>>>> setup?
>>>>
>>> I was just about to finally start looking at this sanity check problem, so
>>> thank you very much for sharing your patch.
>>> I manually tested it on the subset of my configs and it solves the
>>> assertion failure, thanks!
>>> However, I can notice many regressions compared to before the merge:
>>> c-c++-common/asan/alloca_instruments_all_paddings.c
>>> c-c++-common/asan/alloca_loop_unpoisoning.c
>>> c-c++-common/asan/alloca_safe_access.c
>>> c-c++-common/asan/asan-interface-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> c-c++-common/asan/pr59063-1.c
>>> c-c++-common/asan/pr59063-2.c
>>> c-c++-common/asan/pr63316.c
>>> c-c++-common/asan/pr63888.c
>>> c-c++-common/asan/pr70712.c
>>> c-c++-common/asan/pr71480.c
>>> c-c++-common/asan/pr79944.c
>>> c-c++-common/asan/pr80308.c
>>> c-c++-common/asan/swapcontext-test-1.c
>>> gcc.dg/asan/nosanitize-and-inline.c
>>> gcc.dg/asan/pr79196.c
>>> gcc.dg/asan/pr80166.c
>>> gcc.dg/asan/pr81186.c
>>> gcc.dg/asan/use-after-scope-11.c
>>> gcc.dg/asan/use-after-scope-4.c
>>> gcc.dg/asan/use-after-scope-6.c
>>> gcc.dg/asan/use-after-scope-7.c
>>> gcc.dg/asan/use-after-scope-goto-1.c
>>> gcc.dg/asan/use-after-scope-goto-2.c
>>> gcc.dg/asan/use-after-scope-switch-1.c
>>> gcc.dg/asan/use-after-scope-switch-2.c
>>> gcc.dg/asan/use-after-scope-switch-3.c
>>> gcc.dg/asan/use-after-scope-switch-4.c
>>>
>>> out of which only
>>> c-c++-common/asan/swapcontext-test-1.c
>>> c-c++-common/asan/halt_on_error-1.c
>>> print something in gcc.log
>>>
>>> Do they pass for you?
>>
>> Ah, I see. The problem is that after this merge LSan was enabled for ARM.
>> LSan sets atexit handler that calls internal_clone function that's not
>> supported in QEMU.
>> That's why these tests pass on board, but fail under QEMU.
>> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>>
> Hi,
>
> I have a followup on this issue, after investigating a bit more.
>
> I filed a bug report against QEMU, and indeed it seems that it rejects
> clone() as called by the sanitizers on purpose, because it cannot support
> CLONE_UNTRACED.
>
> That being said, I was wondering why the same tests worked "better"
> with qemu-aarch64 (as opposed to qemu-arm). And I noticed that on aarch64,
> we have sanitizer_common/sanitizer_syscall_linux_aarch64.inc where
> internal_iserror returns true if retval >= -4095.
>
> On arm, we use sanitizer_common/sanitizer_syscall_generic.inc where
> internal_iserror returns true if retval == -1.
>
> But on the upstream sanitizer repo,
> sanitizer_common/sanitizer_syscall_linux_arm.inc was added on Nov 8th,
> and also checks for retval >= -4095, hence handling the clone() error
> gracefully. So... can we merge again our sanitizer sources to at least
> http://llvm.org/viewvc/llvm-project?view=revision&revision=317640 ?

Could you check whether attached patch helps you?

Thanks,
-Maxim

>
> Thanks,
>
> Christophe
>
>
>> -Maxim
>>
>>
>>> Thanks,
>>>
>>> Christophe
>>>
>>>> Thanks,
>>>> -Maxim
>>>>
>>>>> Thanks,
>>>>>
>>>>> Christophe
>>>>>
>>>>>
>>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>>> cumulative patch (I guess yes)?
>>>>>> I have done some verification today, diff from upstream r285547 to
>>>>>> unpatched
>>>>>> GCC (with the LLVM Compiler infrastructure two liners removed),
>>>>>> attached P1,
>>>>>> and diff from upstream r315899 to patched GCC (again, two liners
>>>>>> removed),
>>>>>> attached P2 and went through the changes in P1 and verified that except
>>>>>> for
>>>>>> the ubsan backwards compatibility we had that can't work anymore
>>>>>> everything
>>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff from
>>>>>> upstream, with the
>>>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>>> changes now filed upstream.
>>>>>>
>>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable
>>>>>>> them in
>>>>>>> GCC too?
>>>>>> Maybe, feel free to post patches.  For LSan we need to split off
>>>>>> lsan_preinit
>>>>>> out of liblsan and link it into executables, will handle it next (there
>>>>>> is a
>>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>>
>>>>>>           Jakub
>>>>>
>>>>>
>>>
>>>
>>>
>
>
libsanitizer/ChangeLog:

2017-11-16  Maxim Ostapenko  <m.ostapenko@samsung.com>

	* sanitizer_common/sanitizer_syscall_linux_arm.inc: New file.
	* sanitizer_common/sanitizer_linux.cc: Cherry-pick upstream r317640.

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 8fc9256..ea1e795 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -139,6 +139,8 @@ namespace __sanitizer {
 #include "sanitizer_syscall_linux_x86_64.inc"
 #elif SANITIZER_LINUX && defined(__aarch64__)
 #include "sanitizer_syscall_linux_aarch64.inc"
+#elif SANITIZER_LINUX && defined(__arm__)
+#include "sanitizer_syscall_linux_arm.inc"
 #else
 #include "sanitizer_syscall_generic.inc"
 #endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_syscall_linux_arm.inc b/libsanitizer/sanitizer_common/sanitizer_syscall_linux_arm.inc
new file mode 100644
index 0000000..a3fdb9e
--- /dev/null
+++ b/libsanitizer/sanitizer_common/sanitizer_syscall_linux_arm.inc
@@ -0,0 +1,141 @@
+//===-- sanitizer_syscall_linux_arm.inc -------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Implementations of internal_syscall and internal_iserror for Linux/arm.
+//
+//===----------------------------------------------------------------------===//
+
+#define SYSCALL(name) __NR_ ## name
+
+static uptr __internal_syscall(u32 nr) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0");
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall0(n) \
+  (__internal_syscall)(n)
+
+static uptr __internal_syscall(u32 nr, u32 arg1) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall1(n, a1) \
+  (__internal_syscall)(n, (u32)(a1))
+
+static uptr __internal_syscall(u32 nr, u32 arg1, long arg2) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  register u32 r1 asm("r1") = arg2;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0), "r"(r1)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall2(n, a1, a2) \
+  (__internal_syscall)(n, (u32)(a1), (long)(a2))
+
+static uptr __internal_syscall(u32 nr, u32 arg1, long arg2, long arg3) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  register u32 r1 asm("r1") = arg2;
+  register u32 r2 asm("r2") = arg3;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0), "r"(r1), "r"(r2)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall3(n, a1, a2, a3) \
+  (__internal_syscall)(n, (u32)(a1), (long)(a2), (long)(a3))
+
+static uptr __internal_syscall(u32 nr, u32 arg1, long arg2, long arg3,
+                               u32 arg4) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  register u32 r1 asm("r1") = arg2;
+  register u32 r2 asm("r2") = arg3;
+  register u32 r3 asm("r3") = arg4;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0), "r"(r1), "r"(r2), "r"(r3)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall4(n, a1, a2, a3, a4) \
+  (__internal_syscall)(n, (u32)(a1), (long)(a2), (long)(a3), (long)(a4))
+
+static uptr __internal_syscall(u32 nr, u32 arg1, long arg2, long arg3,
+                               u32 arg4, long arg5) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  register u32 r1 asm("r1") = arg2;
+  register u32 r2 asm("r2") = arg3;
+  register u32 r3 asm("r3") = arg4;
+  register u32 r4 asm("r4") = arg5;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall5(n, a1, a2, a3, a4, a5) \
+  (__internal_syscall)(n, (u32)(a1), (long)(a2), (long)(a3), (long)(a4), \
+                       (u32)(a5))
+
+static uptr __internal_syscall(u32 nr, u32 arg1, long arg2, long arg3,
+                               u32 arg4, long arg5, long arg6) {
+  register u32 r8 asm("r7") = nr;
+  register u32 r0 asm("r0") = arg1;
+  register u32 r1 asm("r1") = arg2;
+  register u32 r2 asm("r2") = arg3;
+  register u32 r3 asm("r3") = arg4;
+  register u32 r4 asm("r4") = arg5;
+  register u32 r5 asm("r5") = arg6;
+  asm volatile("swi #0"
+               : "=r"(r0)
+               : "r"(r8), "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5)
+               : "memory", "cc");
+  return r0;
+}
+#define __internal_syscall6(n, a1, a2, a3, a4, a5, a6) \
+  (__internal_syscall)(n, (u32)(a1), (long)(a2), (long)(a3), (long)(a4), \
+                       (u32)(a5), (long)(a6))
+
+#define __SYSCALL_NARGS_X(a1, a2, a3, a4, a5, a6, a7, a8, n, ...) n
+#define __SYSCALL_NARGS(...) \
+  __SYSCALL_NARGS_X(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0, )
+#define __SYSCALL_CONCAT_X(a, b) a##b
+#define __SYSCALL_CONCAT(a, b) __SYSCALL_CONCAT_X(a, b)
+#define __SYSCALL_DISP(b, ...) \
+  __SYSCALL_CONCAT(b, __SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__)
+
+#define internal_syscall(...) __SYSCALL_DISP(__internal_syscall, __VA_ARGS__)
+
+#define internal_syscall_ptr internal_syscall
+#define internal_syscall64 internal_syscall
+
+// Helper function used to avoid cobbler errno.
+bool internal_iserror(uptr retval, int *rverrno) {
+  if (retval >= (uptr)-4095) {
+    if (rverrno)
+      *rverrno = -retval;
+    return true;
+  }
+  return false;
+}
Christophe Lyon Nov. 17, 2017, 4:29 p.m. UTC | #21
On 16 November 2017 at 13:25, Maxim Ostapenko <m.ostapenko@samsung.com> wrote:
> Hi Christophe,
>
> On 13/11/17 15:47, Christophe Lyon wrote:
>>
>> On 30 October 2017 at 16:21, Maxim Ostapenko <m.ostapenko@samsung.com>
>> wrote:
>>>
>>> On 30/10/17 17:08, Christophe Lyon wrote:
>>>>
>>>> On 30/10/2017 11:12, Maxim Ostapenko wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> sorry for the late response.
>>>>>
>>>>> On 20/10/17 13:45, Christophe Lyon wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 19 October 2017 at 13:17, Jakub Jelinek <jakub@redhat.com> wrote:
>>>>>>>
>>>>>>> On Thu, Oct 19, 2017 at 02:07:24PM +0300, Maxim Ostapenko wrote:
>>>>>>>>>
>>>>>>>>> Is the patch (the merge + this incremental) ok for trunk?
>>>>>>>>
>>>>>>>> I think the patch is OK, just wondering about two things:
>>>>>>>
>>>>>>> Richi just approved the patch on IRC, so I'll commit, then we can
>>>>>>> deal
>>>>>>> with
>>>>>>> follow-ups.
>>>>>>>
>>>>>> Does anyone else run these tests on arm?
>>>>>> Since you applied this patch, I'm seeing lots of new errors and
>>>>>> timeouts.
>>>>>> I have been ignoring regression reports for *san because of
>>>>>> yyrandomness
>>>>>> in the results, but the timeouts are a  major inconvenience in testing
>>>>>> because it increases latency a lot in getting results, or worse I get
>>>>>> no
>>>>>> result at all because the validation job is killed before completion.
>>>>>>
>>>>>> Looking at some intermediate logs, I have noticed:
>>>>>> ==24797==AddressSanitizer CHECK failed:
>>>>>> /libsanitizer/asan/asan_poisoning.cc:34
>>>>>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)
>>>>>>       #0 0x408d7d65 in AsanCheckFailed
>>>>>> /libsanitizer/asan/asan_rtl.cc:67
>>>>>>       #1 0x408ecd5d in __sanitizer::CheckFailed(char const*, int, char
>>>>>> const*, unsigned long long, unsigned long long)
>>>>>> /libsanitizer/sanitizer_common/sanitizer_termination.cc:77
>>>>>>       #2 0x408d22d5 in __asan::PoisonShadow(unsigned long, unsigned
>>>>>> long, unsigned char) /libsanitizer/asan/asan_poisoning.cc:34
>>>>>>       #3 0x4085409b in __asan_register_globals
>>>>>> /libsanitizer/asan/asan_globals.cc:368
>>>>>>       #4 0x109eb in _GLOBAL__sub_I_00099_1_ten
>>>>>>
>>>>>>
>>>>>> (/aci-gcc-fsf/builds/gcc-fsf-gccsrc-thumb/obj-arm-none-linux-gnueabi/gcc3/gcc/testsuite/gcc/alloca_big_alignment.exe+0x109eb)
>>>>>>
>>>>>> in MANY (193 in gcc) tests.
>>>>>>
>>>>>> and many others (152 in gcc) just time out individually (eg
>>>>>> c-c++-common/asan/alloca_instruments_all_paddings.c) with no error in
>>>>>> the logs besides Dejagnu's
>>>>>> WARNING: program timed out.
>>>>>>
>>>>>>
>>>>>> Since I'm using an apparently unusual setup, maybe I have to update it
>>>>>> to cope with the new version,
>>>>>> so I'd like to know if others are seeing the same problems on arm?
>>>>>>
>>>>>> I'm using qemu -R 0 to execute the test programs, encapsulated by
>>>>>> proot (similar to chroot, but does not require root privileges).
>>>>>>
>>>>>> Am I missing something obvious?
>>>>>
>>>>>
>>>>> I've caught the same error on my Arndale board. The issue seems to be
>>>>> quite obvious: after merge, ASan requires globals array to be aligned
>>>>> by
>>>>> shadow granularity.
>>>>
>>>>
>>>> Thanks for confirming. I've spent a lot of time investigating the
>>>> timeout
>>>> issues, that led to zombie processes and servers needing reboot. I've
>>>> finally identified that going back to qemu-2.7 avoid the timeout issues
>>>> (I've reported a qemu bug).
>>>>
>>>>> This trivial patch seems to fix the issue. Could you check it on your
>>>>> setup?
>>>>>
>>>> I was just about to finally start looking at this sanity check problem,
>>>> so
>>>> thank you very much for sharing your patch.
>>>> I manually tested it on the subset of my configs and it solves the
>>>> assertion failure, thanks!
>>>> However, I can notice many regressions compared to before the merge:
>>>> c-c++-common/asan/alloca_instruments_all_paddings.c
>>>> c-c++-common/asan/alloca_loop_unpoisoning.c
>>>> c-c++-common/asan/alloca_safe_access.c
>>>> c-c++-common/asan/asan-interface-1.c
>>>> c-c++-common/asan/halt_on_error-1.c
>>>> c-c++-common/asan/pr59063-1.c
>>>> c-c++-common/asan/pr59063-2.c
>>>> c-c++-common/asan/pr63316.c
>>>> c-c++-common/asan/pr63888.c
>>>> c-c++-common/asan/pr70712.c
>>>> c-c++-common/asan/pr71480.c
>>>> c-c++-common/asan/pr79944.c
>>>> c-c++-common/asan/pr80308.c
>>>> c-c++-common/asan/swapcontext-test-1.c
>>>> gcc.dg/asan/nosanitize-and-inline.c
>>>> gcc.dg/asan/pr79196.c
>>>> gcc.dg/asan/pr80166.c
>>>> gcc.dg/asan/pr81186.c
>>>> gcc.dg/asan/use-after-scope-11.c
>>>> gcc.dg/asan/use-after-scope-4.c
>>>> gcc.dg/asan/use-after-scope-6.c
>>>> gcc.dg/asan/use-after-scope-7.c
>>>> gcc.dg/asan/use-after-scope-goto-1.c
>>>> gcc.dg/asan/use-after-scope-goto-2.c
>>>> gcc.dg/asan/use-after-scope-switch-1.c
>>>> gcc.dg/asan/use-after-scope-switch-2.c
>>>> gcc.dg/asan/use-after-scope-switch-3.c
>>>> gcc.dg/asan/use-after-scope-switch-4.c
>>>>
>>>> out of which only
>>>> c-c++-common/asan/swapcontext-test-1.c
>>>> c-c++-common/asan/halt_on_error-1.c
>>>> print something in gcc.log
>>>>
>>>> Do they pass for you?
>>>
>>>
>>> Ah, I see. The problem is that after this merge LSan was enabled for ARM.
>>> LSan sets atexit handler that calls internal_clone function that's not
>>> supported in QEMU.
>>> That's why these tests pass on board, but fail under QEMU.
>>> Could you try set ASAN_OPTIONS=detect_leaks=0 in your environment?
>>>
>> Hi,
>>
>> I have a followup on this issue, after investigating a bit more.
>>
>> I filed a bug report against QEMU, and indeed it seems that it rejects
>> clone() as called by the sanitizers on purpose, because it cannot support
>> CLONE_UNTRACED.
>>
>> That being said, I was wondering why the same tests worked "better"
>> with qemu-aarch64 (as opposed to qemu-arm). And I noticed that on aarch64,
>> we have sanitizer_common/sanitizer_syscall_linux_aarch64.inc where
>> internal_iserror returns true if retval >= -4095.
>>
>> On arm, we use sanitizer_common/sanitizer_syscall_generic.inc where
>> internal_iserror returns true if retval == -1.
>>
>> But on the upstream sanitizer repo,
>> sanitizer_common/sanitizer_syscall_linux_arm.inc was added on Nov 8th,
>> and also checks for retval >= -4095, hence handling the clone() error
>> gracefully. So... can we merge again our sanitizer sources to at least
>> http://llvm.org/viewvc/llvm-project?view=revision&revision=317640 ?
>
>
> Could you check whether attached patch helps you?
>

Yes, it does. Thanks!

Christophe

> Thanks,
> -Maxim
>
>
>>
>> Thanks,
>>
>> Christophe
>>
>>
>>> -Maxim
>>>
>>>
>>>> Thanks,
>>>>
>>>> Christophe
>>>>
>>>>> Thanks,
>>>>> -Maxim
>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Christophe
>>>>>>
>>>>>>
>>>>>>>> 1) We have a bunch of GCC local patches, did you include them into a
>>>>>>>> cumulative patch (I guess yes)?
>>>>>>>
>>>>>>> I have done some verification today, diff from upstream r285547 to
>>>>>>> unpatched
>>>>>>> GCC (with the LLVM Compiler infrastructure two liners removed),
>>>>>>> attached P1,
>>>>>>> and diff from upstream r315899 to patched GCC (again, two liners
>>>>>>> removed),
>>>>>>> attached P2 and went through the changes in P1 and verified that
>>>>>>> except
>>>>>>> for
>>>>>>> the ubsan backwards compatibility we had that can't work anymore
>>>>>>> everything
>>>>>>> else was upstreamed, or remained in P2.  So P2 is the current diff
>>>>>>> from
>>>>>>> upstream, with the
>>>>>>> sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
>>>>>>> changes now filed upstream.
>>>>>>>
>>>>>>>> 2) Upstream has enabled LSan for x86 and ARM, is it worth to enable
>>>>>>>> them in
>>>>>>>> GCC too?
>>>>>>>
>>>>>>> Maybe, feel free to post patches.  For LSan we need to split off
>>>>>>> lsan_preinit
>>>>>>> out of liblsan and link it into executables, will handle it next
>>>>>>> (there
>>>>>>> is a
>>>>>>> PR about it, just wanted to wait until the merge is in).
>>>>>>>
>>>>>>>           Jakub
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>>
>
diff mbox series

Patch

--- gcc/ubsan.c.jj	2017-10-10 22:04:08.000000000 +0200
+++ gcc/ubsan.c	2017-10-16 17:53:44.996067487 +0200
@@ -830,15 +830,17 @@  ubsan_expand_null_ifn (gimple_stmt_itera
       enum built_in_function bcode
 	= (flag_sanitize_recover & ((check_align ? SANITIZE_ALIGNMENT : 0)
 				    | (check_null ? SANITIZE_NULL : 0)))
-	  ? BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH
-	  : BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT;
+	  ? BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1
+	  : BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT;
       tree fn = builtin_decl_implicit (bcode);
+      int align_log = tree_log2 (align);
       tree data
 	= ubsan_create_data ("__ubsan_null_data", 1, &loc,
 			     ubsan_type_descriptor (TREE_TYPE (ckind),
 						    UBSAN_PRINT_POINTER),
 			     NULL_TREE,
-			     align,
+			     build_int_cst (unsigned_char_type_node,
+					    MAX (align_log, 0)),
 			     fold_convert (unsigned_char_type_node, ckind),
 			     NULL_TREE);
       data = build_fold_addr_expr_loc (loc, data);
@@ -1001,14 +1003,14 @@  ubsan_expand_objsize_ifn (gimple_stmt_it
 				 ubsan_type_descriptor (TREE_TYPE (ptr),
 							UBSAN_PRINT_POINTER),
 				 NULL_TREE,
-				 build_zero_cst (pointer_sized_int_node),
+				 build_zero_cst (unsigned_char_type_node),
 				 ckind,
 				 NULL_TREE);
 	  data = build_fold_addr_expr_loc (loc, data);
 	  enum built_in_function bcode
 	    = (flag_sanitize_recover & SANITIZE_OBJECT_SIZE)
-	      ? BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH
-	      : BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT;
+	      ? BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1
+	      : BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT;
 	  tree p = make_ssa_name (pointer_sized_int_node);
 	  g = gimple_build_assign (p, NOP_EXPR, ptr);
 	  gimple_set_location (g, loc);
@@ -2024,15 +2026,18 @@  instrument_nonnull_return (gimple_stmt_i
       else
 	{
 	  tree data = ubsan_create_data ("__ubsan_nonnull_return_data",
-					 2, loc, NULL_TREE, NULL_TREE);
+					 1, &loc[1], NULL_TREE, NULL_TREE);
 	  data = build_fold_addr_expr_loc (loc[0], data);
+	  tree data2 = ubsan_create_data ("__ubsan_nonnull_return_data",
+					  1, &loc[0], NULL_TREE, NULL_TREE);
+	  data2 = build_fold_addr_expr_loc (loc[0], data2);
 	  enum built_in_function bcode
 	    = (flag_sanitize_recover & SANITIZE_RETURNS_NONNULL_ATTRIBUTE)
-	      ? BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN
-	      : BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT;
+	      ? BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1
+	      : BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT;
 	  tree fn = builtin_decl_explicit (bcode);
 
-	  g = gimple_build_call (fn, 1, data);
+	  g = gimple_build_call (fn, 2, data, data2);
 	}
       gimple_set_location (g, loc[0]);
       gsi_insert_before (gsi, g, GSI_SAME_STMT);
--- gcc/sanitizer.def.jj	2017-09-06 16:30:06.000000000 +0200
+++ gcc/sanitizer.def	2017-10-16 17:45:35.544915910 +0200
@@ -424,8 +424,8 @@  DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN
 		      "__ubsan_handle_vla_bound_not_positive",
 		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NOTHROW_LEAF_LIST)
-DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
-		      "__ubsan_handle_type_mismatch",
+DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
+		      "__ubsan_handle_type_mismatch_v1",
 		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_ADD_OVERFLOW,
@@ -464,8 +464,8 @@  DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN
 		      "__ubsan_handle_vla_bound_not_positive_abort",
 		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
-DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
-		      "__ubsan_handle_type_mismatch_abort",
+DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
+		      "__ubsan_handle_type_mismatch_v1_abort",
 		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_ADD_OVERFLOW_ABORT,
@@ -516,13 +516,13 @@  DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HAN
 		      "__ubsan_handle_nonnull_arg_abort",
 		      BT_FN_VOID_PTR,
 		      ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
-DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
-		      "__ubsan_handle_nonnull_return",
-		      BT_FN_VOID_PTR,
+DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
+		      "__ubsan_handle_nonnull_return_v1",
+		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NOTHROW_LEAF_LIST)
-DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT,
-		      "__ubsan_handle_nonnull_return_abort",
-		      BT_FN_VOID_PTR,
+DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT,
+		      "__ubsan_handle_nonnull_return_v1_abort",
+		      BT_FN_VOID_PTR_PTR,
 		      ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS,
 		      "__ubsan_handle_dynamic_type_cache_miss",
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c.jj	2017-02-15 13:19:09.000000000 +0100
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c	2017-10-16 18:34:17.791894454 +0200
@@ -99,45 +99,45 @@  main ()
 }
 
 /* float */
-/* { dg-output "value -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output " -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
 /* No error for float and __int128 unsigned max value, as ui128_MAX is +Inf in float.  */
 /* double */
-/* { dg-output "\[^\n\r]*value -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output "\[^\n\r]* -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
 /* long double */
-/* { dg-output "\[^\n\r]*value -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output "\[^\n\r]* -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" { target { ilp32 || lp64 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target { int128 } } } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-10.c.jj	2015-10-29 09:14:30.000000000 +0100
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-10.c	2017-10-16 18:34:21.867845577 +0200
@@ -9,38 +9,38 @@ 
 #include "float-cast-overflow-8.c"
 
 /* _Decimal32 */
-/* { dg-output "value <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
 /* _Decimal64 */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
 /* _Decimal128 */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-9.c.jj	2015-10-29 09:14:30.000000000 +0100
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-9.c	2017-10-16 18:34:25.911797083 +0200
@@ -6,30 +6,30 @@ 
 #include "float-cast-overflow-8.c"
 
 /* __float80 */
-/* { dg-output "value -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
+/* { dg-output " -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* (-129|-1) is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[0-9.e+-]* is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
 /* __float128 */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
-/* { dg-output "\[^\n\r]*value <unknown> is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
+/* { dg-output "\[^\n\r]* <unknown> is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" { target int128 } } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-3.c.jj	2014-08-01 09:23:41.000000000 +0200
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-3.c	2017-10-16 18:34:29.698751672 +0200
@@ -26,15 +26,15 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -133* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 132 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 260 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type" } */
+/* { dg-output " -133* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 132 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 260 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-5.c.jj	2014-08-01 09:23:41.000000000 +0200
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-5.c	2017-10-16 18:34:33.273708802 +0200
@@ -26,15 +26,15 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value \[^\n\r]* is outside the range of representable values of type" } */
+/* { dg-output " \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* \[^\n\r]* is outside the range of representable values of type" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-6.c.jj	2014-11-11 00:06:10.000000000 +0100
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-6.c	2017-10-16 18:34:38.274648833 +0200
@@ -26,15 +26,15 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -133 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 132 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 260 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type" } */
+/* { dg-output " -133 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 132 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 260 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c.jj	2017-07-19 14:01:21.000000000 +0200
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c	2017-10-16 18:34:42.391599464 +0200
@@ -91,115 +91,115 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -133 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129.5 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 128.5 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 132 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 256.5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 260 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32773 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769.5 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 32768 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 32768.5 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 32772 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 65536 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 65536.5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 65540 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type 'long long unsigned int'" } */
+/* { dg-output " -133 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129.5 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -129 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 128.5 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 132 is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'signed char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 256.5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 260 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'unsigned char'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32773 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769.5 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -32769 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 32768 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 32768.5 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 32772 is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'short int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 65536 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 65536.5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 65540 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'short unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 9.22337e\\\+18 is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'long long int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.84467e\\\+19 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type 'long long unsigned int'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type 'long long unsigned int'" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-4.c.jj	2014-08-01 09:23:41.000000000 +0200
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-4.c	2017-10-16 18:34:50.272504959 +0200
@@ -30,23 +30,23 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -inf is outside the range of representable values of type" } */
+/* { dg-output " -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -?nan is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* inf is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -inf is outside the range of representable values of type" } */
--- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-2.c.jj	2014-08-01 09:23:41.000000000 +0200
+++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-2.c	2017-10-16 18:35:00.423383234 +0200
@@ -30,44 +30,44 @@  main (void)
   return 0;
 }
 
-/* { dg-output "runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value nan is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -?nan is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value inf is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -inf is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -5 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -1.5 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value nan is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -?nan is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value inf is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*runtime error: value -inf is outside the range of representable values of type '__int128 unsigned'" } */
+/* { dg-output "runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 1.70141e\\\+38 is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: nan is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -?nan is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: inf is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -inf is outside the range of representable values of type '__int128'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: 3.40282e\\\+38 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -5 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -1.5 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -1 is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: nan is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -?nan is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: inf is outside the range of representable values of type '__int128 unsigned'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*runtime error: -inf is outside the range of representable values of type '__int128 unsigned'" } */
--- gcc/testsuite/g++.dg/ubsan/float-cast-overflow-bf.C.jj	2014-08-01 09:23:40.000000000 +0200
+++ gcc/testsuite/g++.dg/ubsan/float-cast-overflow-bf.C	2017-10-16 20:19:08.525046792 +0200
@@ -52,11 +52,11 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type" } */
+/* { dg-output " -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.14748e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 4.29497e\\\+09 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type" } */
--- gcc/testsuite/gcc.dg/ubsan/float-cast-overflow-bf.c.jj	2014-08-01 09:23:39.000000000 +0200
+++ gcc/testsuite/gcc.dg/ubsan/float-cast-overflow-bf.c	2017-10-16 20:18:50.061277584 +0200
@@ -48,25 +48,25 @@  main (void)
   return 0;
 }
 
-/* { dg-output "value -2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*value 2.5 is outside the range of representable values of type" } */
+/* { dg-output " -2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1.5 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* -1 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2 is outside the range of representable values of type\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]* 2.5 is outside the range of representable values of type" } */
--- libsanitizer/MERGE	(revision 253759)
+++ libsanitizer/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-285547
+315899
 
 The first line of this file holds the svn revision number of the
 last merge done from the master library sources.
--- libsanitizer/Makefile.am	(revision 253759)
+++ libsanitizer/Makefile.am	(working copy)
@@ -17,7 +17,8 @@  endif
 SUBDIRS += lsan asan ubsan
 nodist_saninclude_HEADERS += \
   include/sanitizer/lsan_interface.h \
-  include/sanitizer/asan_interface.h
+  include/sanitizer/asan_interface.h \
+  include/sanitizer/tsan_interface.h
 if TSAN_SUPPORTED
 SUBDIRS += tsan
 endif
--- libsanitizer/asan/Makefile.am	(revision 253759)
+++ libsanitizer/asan/Makefile.am	(working copy)
@@ -25,6 +25,7 @@  asan_files = \
 	asan_flags.cc \
 	asan_globals.cc \
 	asan_interceptors.cc \
+	asan_interceptors_memintrinsics.cc \
 	asan_linux.cc \
 	asan_mac.cc \
 	asan_malloc_linux.cc \
@@ -36,6 +37,7 @@  asan_files = \
 	asan_posix.cc \
 	asan_report.cc \
 	asan_rtl.cc \
+	asan_shadow_setup.cc \
 	asan_stack.cc \
 	asan_stats.cc \
 	asan_suppressions.cc \
--- libsanitizer/asan/libtool-version	(revision 253759)
+++ libsanitizer/asan/libtool-version	(working copy)
@@ -3,4 +3,4 @@ 
 # a separate file so that version updates don't involve re-running
 # automake.
 # CURRENT:REVISION:AGE
-4:0:0
+5:0:0
--- libsanitizer/lsan/Makefile.am	(revision 253759)
+++ libsanitizer/lsan/Makefile.am	(working copy)
@@ -16,11 +16,15 @@  endif
 
 sanitizer_lsan_files = \
 	lsan_common.cc \
-	lsan_common_linux.cc
+	lsan_common_linux.cc \
+	lsan_common_mac.cc
 
 lsan_files = \
 	$(sanitizer_lsan_files) \
 	lsan.cc \
+	lsan_linux.cc \
+	lsan_mac.cc \
+	lsan_malloc_mac.cc \
 	lsan_allocator.cc \
 	lsan_interceptors.cc \
 	lsan_preinit.cc \
--- libsanitizer/sanitizer_common/Makefile.am	(revision 253759)
+++ libsanitizer/sanitizer_common/Makefile.am	(working copy)
@@ -19,13 +19,16 @@  ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libsanitizer_common.la
 
 sanitizer_common_files = \
+	sancov_flags.cc \
 	sanitizer_allocator.cc \
+	sanitizer_allocator_checks.cc \
 	sanitizer_common.cc \
 	sanitizer_common_libcdep.cc \
-	sanitizer_coverage_libcdep.cc \
-	sanitizer_coverage_mapping_libcdep.cc \
+	sanitizer_coverage_libcdep_new.cc \
 	sanitizer_deadlock_detector1.cc \
 	sanitizer_deadlock_detector2.cc \
+	sanitizer_errno.cc \
+	sanitizer_file.cc \
 	sanitizer_flags.cc \
 	sanitizer_flag_parser.cc \
 	sanitizer_libc.cc \
@@ -34,6 +37,7 @@  sanitizer_common_files = \
 	sanitizer_linux_libcdep.cc \
 	sanitizer_linux_s390.cc \
 	sanitizer_mac.cc \
+	sanitizer_mac_libcdep.cc \
 	sanitizer_persistent_allocator.cc \
 	sanitizer_platform_limits_linux.cc \
 	sanitizer_platform_limits_posix.cc \
@@ -50,6 +54,7 @@  sanitizer_common_files = \
 	sanitizer_symbolizer_mac.cc \
 	sanitizer_stacktrace_printer.cc \
 	sanitizer_stoptheworld_linux_libcdep.cc \
+	sanitizer_stoptheworld_mac.cc \
 	sanitizer_suppressions.cc \
 	sanitizer_symbolizer.cc \
 	sanitizer_symbolizer_libbacktrace.cc \
--- libsanitizer/tsan/Makefile.am	(revision 253759)
+++ libsanitizer/tsan/Makefile.am	(working copy)
@@ -15,6 +15,7 @@  nodist_toolexeclib_HEADERS = libtsan_pre
 tsan_files = \
 	tsan_clock.cc \
 	tsan_debugging.cc \
+	tsan_external.cc \
 	tsan_fd.cc \
 	tsan_flags.cc \
 	tsan_ignoreset.cc \
--- libsanitizer/ubsan/Makefile.am	(revision 253759)
+++ libsanitizer/ubsan/Makefile.am	(working copy)
@@ -3,7 +3,7 @@  AM_CPPFLAGS = -I $(top_srcdir) -I $(top_
 # May be used by toolexeclibdir.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
-DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1
+DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 AM_CXXFLAGS += -std=gnu++11
@@ -24,7 +24,8 @@  ubsan_plugin_files = \
 
 ubsan_files = \
 	$(ubsan_plugin_files) \
-	ubsan_init_standalone.cc
+	ubsan_init_standalone.cc \
+	ubsan_signals_standalone.cc
 
 libubsan_la_SOURCES = $(ubsan_files) 
 libubsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la 
--- libsanitizer/ubsan/libtool-version	(revision 253759)
+++ libsanitizer/ubsan/libtool-version	(working copy)
@@ -3,4 +3,4 @@ 
 # a separate file so that version updates don't involve re-running
 # automake.
 # CURRENT:REVISION:AGE
-0:0:0
+1:0:0