Closed Bug 1619206 Opened 4 years ago Closed 4 years ago

error: initializer for thread-local variable must be a constant expression

Categories

(Core :: Networking: JAR, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged])

with clang trunk on a Debian:

In file included from Unified_cpp_modules_libjar0.cpp:2:
/var/lib/jenkins/workspace/firefox-clang-last/modules/libjar/MmapFaultHandler.cpp:18:43: error: initializer for thread-local variable must be a constant expression
static MOZ_THREAD_LOCAL(MmapAccessScope*) sMmapAccessScope;
                                          ^~~~~~~~~~~~~~~~
/var/lib/jenkins/workspace/firefox-clang-last/modules/libjar/MmapFaultHandler.cpp:18:43: note: use 'thread_local' to allow this

This may be a bug in clang, the implicit = nullptr initializer for this pointer seems like an acceptable constant expression.

It may or may not be a clang bug, but I think this was tickled by something that changed on the m-c side. I'm seeing this failure now even with 10.0.0 RC revisions that had previously given successful builds.

Bisection points to bug 1618165, which seems unrelated to libjar. Perhaps that commit might have brought to light a latent bug in clang-10 (was it gecko's first use of deduction guides?)

Regressed by: 1618165
Has Regression Range: --- → yes
Keywords: regression

The worst part is that I can't reproduce this locally, not even with the same clang from CI!

(In reply to :dmajor from comment #3)

Bisection points to bug 1618165, which seems unrelated to libjar. Perhaps that commit might have brought to light a latent bug in clang-10 (was it gecko's first use of deduction guides?)

AFAIK, this was Gecko's first use of deduction guides (maybe Skia or ANGLE or something that's super-aggressive about C++ support might have had them first).

Ok, by turning the diagnostic into a crash, and saving the crash reproducer from CI, I can finally reproduce this locally. I'll continue looking tomorrow.

Interesting. Does MOZ_THREAD_LOCAL use a BaseAutoLock? I had a brief look, but at least couldn't find any use of it.

Component: File Handling → Networking: JAR
Product: Firefox → Core

Michal, can you take a look?

Flags: needinfo?(michal.novotny)

Looks like a bug in clang. I'm not sure what we can do in libjar.

Flags: needinfo?(michal.novotny)
Priority: -- → P3
Whiteboard: [necko-triaged]

Fixed in 11. I asked for the clang patch to be fixed in 10.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.