diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -129,12 +129,13 @@ // Exit immediately if we don't need to return to the caller. // This saves time because the overhead of calling destructors // for all globally-allocated objects is not negligible. - int hasError = errorCount() ? 1 : 0; if (canExitEarly) - exitLld(hasError); - else + exitLld(errorCount() ? 1 : 0); + + bool ret = errorCount() == 0; + if (!canExitEarly) errorHandler().reset(); - return !hasError; + return ret; } // Parses a linker -m option. diff --git a/openmp/libomptarget/test/offloading/bug50022.cpp b/openmp/libomptarget/test/offloading/bug50022.cpp --- a/openmp/libomptarget/test/offloading/bug50022.cpp +++ b/openmp/libomptarget/test/offloading/bug50022.cpp @@ -33,7 +33,7 @@ #pragma omp taskwait - assert(a == 3 && "wrong result!"); + assert(a == 3 && "wrong result2!"); return 0; }