Closed Bug 1754752 Opened 4 years ago Closed 4 years ago

[GCC12] error: call to non-‘constexpr’ function

Categories

(Firefox Build System :: General, defect, P3)

defect

Tracking

(firefox-esr91 fixed, firefox99 fixed)

RESOLVED FIXED
99 Branch
Tracking Status
firefox-esr91 --- fixed
firefox99 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

Details

Attachments

(3 files)

Firefox fails to build with gcc 12 (Fedora 36):

 0:38.65 /home/komat/src/mozilla-unified/objdir-opt/dist/include/mozilla/TimingParams.h: In constructor ‘constexpr mozilla::TimingParams::TimingParams(const mozilla::TimeDuration&, const mozilla::TimeDuration&, const mozilla::TimeDuration&, float, float, mozilla::dom::PlaybackDirection, mozilla::dom::FillMode, mozilla::Maybe<mozilla::ComputedTimingFunction>&&)’:
 0:38.65 /home/komat/src/mozilla-unified/objdir-opt/dist/include/mozilla/TimingParams.h:58:11: error: call to non-‘constexpr’ function ‘void mozilla::TimingParams::Update()’
 0:38.65    58 |     Update();
 0:38.65       |     ~~~~~~^~
 0:38.65 /home/komat/src/mozilla-unified/objdir-opt/dist/include/mozilla/TimingParams.h:209:8: note: ‘void mozilla::TimingParams::Update()’ declared here
 0:38.65   209 |   void Update() {
 0:38.65       |        ^~~~~~
 0:37.20 /home/komat/src/mozilla-unified/objdir-opt/dist/include/mozilla/TimingParams.h:38:59: error: call to non-‘constexpr’ function ‘static mozilla::BaseTimeDuration<ValueCalculator> mozilla::BaseTimeDuration<ValueCalculator>::FromMilliseconds(double) [with ValueCalculator = mozilla::StickyTimeDurationValueCalculator]’
 0:37.20    38 |     mDuration.emplace(StickyTimeDuration::FromMilliseconds(aDuration));

And there's another constexpr bug:

 0:17.18   cargo:warning=src/glsl.h: In constructor ‘constexpr glsl::mat3::mat3(glsl::mat3_scalar)’:
 0:17.18   cargo:warning=src/glsl.h:2414:29: error: call to non-‘constexpr’ function ‘glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)’
 0:17.18   cargo:warning= 2414 |     data[0] = vec3(s.data[0]);
 0:17.18   cargo:warning=      |                             ^
 0:17.18   cargo:warning=src/glsl.h:1477:8: note: ‘glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)’ is not usable as a ‘constexpr’ function because:
 0:17.18   cargo:warning= 1477 | struct vec3 {
 0:17.18   cargo:warning=      |        ^~~~
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: defaulted constructor calls non-‘constexpr’ ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’
 0:17.18   cargo:warning=  266 |   VectorType& operator=(VectorType x) {
 0:17.18   cargo:warning=      |               ^~~~~~~~
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’ declared here
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: defaulted constructor calls non-‘constexpr’ ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’ declared here
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: defaulted constructor calls non-‘constexpr’ ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’
 0:17.18   cargo:warning=src/vector_type.h:266:15: note: ‘glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]’ declared here
 0:17.18   cargo:warning=src/glsl.h: In constructor ‘constexpr glsl::mat3::mat3(glsl::mat3_scalar, glsl::mat3_scalar, glsl::mat3_scalar, glsl::mat3_scalar)’:
 0:17.18   cargo:warning=src/glsl.h:2420:66: error: call to non-‘constexpr’ function ‘glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)’
 0:17.18   cargo:warning= 2420 |     data[0] = vec3(s0.data[0], s1.data[0], s2.data[0], s3.data[0]);
 0:17.18   cargo:warning=      |                                                                  ^
 0:17.19   cargo:warning=src/glsl.h: In constructor ‘constexpr glsl::mat3::mat3(glsl::Float, glsl::Float, glsl::Float, glsl::Float, glsl::Float, glsl::Float, glsl::Float, glsl::Float, glsl::Float)’:
 0:17.19   cargo:warning=src/glsl.h:2427:30: error: call to non-‘constexpr’ function ‘glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)’
 0:17.19   cargo:warning= 2427 |     data[0] = vec3(d1, d2, d3);
 0:17.19   cargo:warning=      |                              ^
 0:17.19   cargo:warning=src/glsl.h: At global scope:
 0:17.19   cargo:warning=src/glsl.h:2600:40: warning: ‘annotate’ attribute directive ignored [-Wattributes]
 0:17.19   cargo:warning= 2600 |   IMPLICIT constexpr mat4(mat4_scalar s) {
 0:17.19   cargo:warning=      |                                        ^
 0:17.19   cargo:warning=src/glsl.h: In constructor ‘constexpr glsl::mat4::mat4(glsl::mat4_scalar)’:
 0:17.19   cargo:warning=src/glsl.h:2601:29: error: call to non-‘constexpr’ function ‘glsl::vec4& glsl::vec4::operator=(glsl::vec4&&)’
 0:17.19   cargo:warning= 2601 |     data[0] = vec4(s.data[0]);
Summary: [GCC12] TimingParams.h:58:11: error: call to non-‘constexpr’ function ‘void mozilla::TimingParams::Update()’ → [GCC12] error: call to non-‘constexpr’ function
Priority: -- → P3

Those seem like legit bugs? ni? boris for the ActiveParams issue (was introduced in bug 1676791).

Flags: needinfo?(boris.chiou)
Assignee: nobody → stransky
Status: NEW → ASSIGNED

Emilio, any hint how to fix the cargo:warning=src/glsl.h ? I guess that's some c/rust binding or so? I have zero experience with that.
Thanks.

Flags: needinfo?(emilio)

We call it from another constexpr function. Clang seems to not be so
strict about this.

it's a regular C++ build of swgl, but it's driven by a rust build script. Anyways ^ fixes it.

Flags: needinfo?(emilio)
Flags: needinfo?(boris.chiou)
Attachment #9264479 - Attachment description: Bug 1754752 - Make VectorType::operator= constexpr. r=lsalzman,#gfx-reviewers → Bug 1754752 - Use initializer lists in some swgl constructors. r=lsalzman,#gfx-reviewers

Cool, Thanks a lot!

Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/4787f2d8a873 Remove constexpr from non constant functions r=emilio
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8af9ccb50f19 Use initializer lists in some swgl constructors. r=lsalzman,gfx-reviewers
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/00128c425ebb Avoid a ton of warning spam when building swgl with gcc. r=lsalzman
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
Blocks: 1771932

Comment on attachment 9264479 [details]
Bug 1754752 - Use initializer lists in some swgl constructors. r=lsalzman,#gfx-reviewers

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: ESR 91 fails to build with GCC 12.
  • User impact if declined: Users with GCC 12 are unable to build Firefox.
  • Fix Landed on Version:
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Doesn't change any semantics, so no risk.
Attachment #9264479 - Flags: approval-mozilla-esr91?
Attachment #9264393 - Flags: approval-mozilla-esr91?
Attachment #9264393 - Flags: approval-mozilla-esr91?

Comment on attachment 9264479 [details]
Bug 1754752 - Use initializer lists in some swgl constructors. r=lsalzman,#gfx-reviewers

Approved for 91.11esr.

Attachment #9264479 - Flags: approval-mozilla-esr91? → approval-mozilla-esr91+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: