Closed Bug 1607952 Opened 6 years ago Closed 6 years ago

Construction of ComputedGridTrackInfo uses a method and std::move on the same variable

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: alaskanemily, Assigned: alaskanemily)

Details

Attachments

(1 file, 1 obsolete file)

This can be seen at https://searchfox.org/mozilla-central/rev/be7d1f2d52dd9474ca2df145190a817614c924e4/layout/generic/nsGridContainerFrame.cpp#7624

The order of argument evaluation is implementation-defined, so we can't trust whether the .Length() or the std::move() will get executed first.

The order of argument evaluation is implementation-defined, so we can't trust
whether the .Length() or the std::move() will get executed first.

I was originally wrong, since the constructor takes this argument by rvalue and so the result will be correct.

This is still a little scary because a change to the types in the constructor's argument list could make this still compile, but then depend on compiler-dependent argument evaluation order to get the correct result.

Summary: Construction of ComputedGridTrackInfo depends on compiler implementation-defined behavior → Construction of ComputedGridTrackInfo uses a method and std::move on the same variable

The order of argument evaluation is implementation-defined, so we can't trust
whether the .Length() or the std::move() will get executed first. This is OK
right now since the constructor takes the argument by rvalue and so it can't be
emptied out before the .Length() call. However, a change to the types in the
constructor's argument list could make this still compile, but then depend on
compiler-dependent argument evaluation order to get the correct result.

Attachment #9119597 - Attachment is obsolete: true
Attachment #9119585 - Attachment description: Bug 1607952 - Avoid implementation-defined behavior when getting the number of explicit tracks for ComputedGridTrackInfo → Bug 1607952 - Avoid using both std::move and a method on the same variable for getting the number of explicit tracks for ComputedGridTrackInfo
Pushed by rmaries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/92cfc3ecc1f6 Avoid using both std::move and a method on the same variable for getting the number of explicit tracks for ComputedGridTrackInfo r=emilio
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: