New issue
Advanced search Search tips

Issue 912152 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

nacl-clang has bugs in template instantiation

Project Member Reported by brat...@opera.com, Dec 5

Issue description

(I don't expect this to ever be fixed but I need something to refer to when disabling jumbo for nacl in ppapi).

You can get strange bind errors if you instantiate similar types twice in the same translation unit with the nacl-clang toolchain. The ordinary toolchain is happy enough.

Error message:

FAILED: irt_x64/obj/ppapi/shared_impl/shared_impl/shared_impl_jumbo_2.o 
/home/bratell/goma/gomacc ../../native_client/toolchain/linux_x86/pnacl_newlib/bin/x86_64-nacl-clang++ -MMD -MF irt_x64/obj/ppapi/shared_impl/shared_impl/shared_impl_jumbo_2.o.d -DNACL_TC_REV=b48266b051f596802addff7c8d1fc6fb9cf6bea7 -DPPAPI_SHARED_IMPLEMENTATION -DPPAPI_THUNK_IMPLEMENTATION -DV8_DEPRECATION_WARNINGS -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DOFFICIAL_BUILD -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"346388-5\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -I. -I../.. -Iirt_x64/gen -I../../third_party/khronos -I../../gpu -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/protobuf/src -fno-strict-aliasing -fcolor-diagnostics -fmerge-all-constants -U__STRICT_ANSI__ -integrated-as -m64 -march=x86-64 -fasynchronous-unwind-tables -fomit-frame-pointer -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Os -ffunction-sections -fdata-sections -fomit-frame-pointer -g2 -fvisibility=hidden -Wno-shorten-64-to-32 -std=c++14 -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -c irt_x64/gen/ppapi/shared_impl/shared_impl_jumbo_2.cc -o irt_x64/obj/ppapi/shared_impl/shared_impl/shared_impl_jumbo_2.o
In file included from irt_x64/gen/ppapi/shared_impl/shared_impl_jumbo_2.cc:6:
In file included from ./../../ppapi/shared_impl/resource_tracker.cc:7:
In file included from ../../base/bind.h:10:
In file included from ../../base/bind_internal.h:15:
../../base/memory/raw_scoped_refptr_mismatch_checker.h:30:61: error: 'AddRef' is a private member of 'scoped_refptr<ppapi::internal::ThreadAwareCallbackBase::Core>'
                        void_t<decltype(std::declval<T*>()->AddRef()),
                                                            ^
../../base/bind_internal.h:903:11: note: in instantiation of template class 'base::internal::IsRefCountedType<ppapi::TrackedCallback, void>' requested here
          IsRefCountedType<std::remove_pointer_t<DecayedReceiver>>::value,
          ^
../../base/bind_internal.h:920:1: note: in instantiation of template class 'base::internal::MakeBindStateTypeImpl<true, void (ppapi::TrackedCallback::*)(int), ppapi::TrackedCallback *, int &>' requested here
using MakeBindStateType =
^
../../base/bind.h:247:31: note: in instantiation of template type alias 'MakeBindStateType' requested here
  using BindState = internal::MakeBindStateType<Functor, Args...>;
                              ^
../../base/bind.h:270:16: note: in instantiation of function template specialization 'base::BindRepeating<void (ppapi::TrackedCallback::*)(int), ppapi::TrackedCallback *, int &>' requested here
  return base::BindRepeating(std::forward<Functor>(functor),
               ^
./../../ppapi/shared_impl/tracked_callback.cc:257:30: note: in instantiation of function template specialization 'base::Bind<void (ppapi::TrackedCallback::*)(int), ppapi::TrackedCallback *, int &>' requested here
        RunWhileLocked(base::Bind(&TrackedCallback::Run, this, result)));
                             ^
../../base/memory/scoped_refptr.h:277:15: note: declared private here
  static void AddRef(T* ptr);
              ^
1 error generated.


----

A minimized (kind of, ran out of energy when coming to bind.h) test case:

#include "base/bind.h"
#include "base/callback.h"

class TrackedCallback : public base::RefCounted<TrackedCallback> {
};

class FileRefResource : public base::RefCounted<FileRefResource> {
public:
  int32_t Touch();
  void RunTrackedCallback(scoped_refptr<TrackedCallback> callback);
};

int32_t FileRefResource::Touch() {
  scoped_refptr<TrackedCallback> callback;
  base::Bind(&FileRefResource::RunTrackedCallback, this, callback);
  return 1;
}

class FileSystemResource : public base::RefCounted<FileSystemResource>{
 public:
  void ReserveQuota();
  void ReserveQuotaComplete();
};

void FileSystemResource::ReserveQuota() {
  base::Bind(&FileSystemResource::ReserveQuotaComplete, this);
}


This was discovered by https://chromium-review.googlesource.com/c/chromium/src/+/1346999
Failing bot: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux-jumbo-rel/132406
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8928117680806033936/+/steps/compile__with_patch_/0/stdout
 
Cc: f...@opera.com
Project Member

Comment 2 by bugdroid1@chromium.org, Dec 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/032fadc2730ac8da56b6abd90a1633d696ba8373

commit 032fadc2730ac8da56b6abd90a1633d696ba8373
Author: Daniel Bratell <bratell@opera.com>
Date: Wed Dec 05 17:48:42 2018

Don't build ppapi/{proxy,shared_impl} with jumbo in nacl

An upcoming CL triggers nacl toolchain problems in jumbo builds where
some combination of template instantiations cause some build errors.
To not block that CL, disable jumbo for nacl in relevant directories.

Bug: 912152
Change-Id: Ie79729414d765fec22325bacdb7df8cf714457f3
Reviewed-on: https://chromium-review.googlesource.com/c/1363282
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#614014}
[modify] https://crrev.com/032fadc2730ac8da56b6abd90a1633d696ba8373/ppapi/proxy/BUILD.gn
[modify] https://crrev.com/032fadc2730ac8da56b6abd90a1633d696ba8373/ppapi/shared_impl/BUILD.gn

Sign in to add a comment