Open Bug 1713968 Opened 3 years ago Updated 1 year ago

[gcc 11] js/src/builtin/streams/PipeToState.cpp:282:3: error: ‘this’ pointer is null [-Werror=nonnull]

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

Tracking Status
firefox91 --- affected

People

(Reporter: spectre, Unassigned)

Details

Detected in Firefox 89 with gcc 11.1.1 on Fedora 34 but appears to occur on trunk as well.

 1:56.36 In file included from Unified_cpp_js_src6.cpp:2:
 1:56.36 /home/spectre/src/mozilla-release/js/src/builtin/streams/PipeToState.cpp: In static member function ‘static bool ActAndFinalize(JSContext*, JS::Handle<js::PipeToState*>, JS::Handle<mozilla::Maybe<JS::Value> >)::<lambda(JSContext*, unsigned int, JS::Value*)>::_FUN(JSContext*, unsigned int, JS::Value*)’:
 1:56.36 /home/spectre/src/mozilla-release/js/src/builtin/streams/PipeToState.cpp:282:3: error: ‘this’ pointer is null [-Werror=nonnull]
 1:56.36   282 |   };
 1:56.36       |   ^
 1:56.36 /home/spectre/src/mozilla-release/js/src/builtin/streams/PipeToState.cpp:268:21: note: in a call to non-static member function ‘ActAndFinalize(JSContext*, JS::Handle<js::PipeToState*>, JS::Handle<mozilla::Maybe<JS::Value> >)::<lambda(JSContext*, unsigned int, JS::Value*)>’
 1:56.36   268 |   auto OnRejected = [](JSContext* cx, unsigned argc, Value* vp) {
 1:56.36       |                     ^

Workaround is to disable the warning-to-error with a pragma.

Are you using the default compiler flags or do you use your own? Because my build of trunk on Fedora 34 on s390x with the fresh gcc-11.1.1-3.fc34 passed OK.

This seems like it might be a bug in gcc. (The release notes for gcc 11 mention changes to -Wnonnull.) At the very least, the error messages are about member functions, but they're referring to a lambda in a non-member function. I don't immediately see anything wrong with our code here.

Standard flags. I still just see gcc-11.1.1-1.fc34.ppc64le available. I don't see a 1-3.

I took it directly from the buildsystem (https://koji.fedoraproject.org/koji/taskinfo?taskID=69040314), but it should be available in testing updates soon.

I'm still seeing this even with the updated gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3) on ppc64le. I don't know why that would be different on s390x; the frontend should be the same.

I see no problem with build on F-34/ppc64le with gcc-11.1.1-3.fc34.ppc64le and this .mozconfig

export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
export PATH=$HOME/.cargo/bin:$PATH

mk_add_options MOZ_MAKE_FLAGS="-j16"
ac_add_options --enable-application=browser
#ac_add_options --enable-optimize="-Og"
ac_add_options --disable-debug
ac_add_options --enable-release
#ac_add_options --disable-tests
#ac_add_options --enable-linker=bfd

I recall seeing similar issues with gcc 10 when enabling warning as errors. However looking at the errors sounded like bogus error reports.

This does not mean that we should not clean these warning messages.

Severity: -- → S4
Type: task → defect
Priority: -- → P3

(In reply to Dan Horák from comment #6)

I see no problem with build on F-34/ppc64le with gcc-11.1.1-3.fc34.ppc64le and this .mozconfig

I dunno what to say. The configs I'm using are on https://www.talospace.com/2021/02/firefox-86-on-power.html but neither work without adding #pragma GCC diagnostic ignored "-Wnonnull" to this file. I removed -mcpu=power9 and --enable-debug and the warning still gets promoted to an error. Otherwise it's a vanilla tree (I compile "straight up" before adding my own local patches).

I've narrowed this down. The reason why the Fedora package doesn't bug out is because its generated .mozconfig uses -fpermissive. I've added that to my compiler flags, but I'll defer to :nbp and others on the actual underlying warning.

I noticed the same issue on x86_64 with OpenSUSE.

(In reply to Cameron Kaiser [:spectre] from comment #8)

(In reply to Dan Horák from comment #6)

I see no problem with build on F-34/ppc64le with gcc-11.1.1-3.fc34.ppc64le and this .mozconfig

I dunno what to say. The configs I'm using are on https://www.talospace.com/2021/02/firefox-86-on-power.html but neither work without adding #pragma GCC diagnostic ignored "-Wnonnull" to this file. I removed -mcpu=power9 and --enable-debug and the warning still gets promoted to an error. Otherwise it's a vanilla tree (I compile "straight up" before adding my own local patches).

My last comment was responding to ^

(In reply to Cameron Kaiser [:spectre] from comment #8)

(In reply to Dan Horák from comment #6)

I see no problem with build on F-34/ppc64le with gcc-11.1.1-3.fc34.ppc64le and this .mozconfig

I dunno what to say. The configs I'm using are on https://www.talospace.com/2021/02/firefox-86-on-power.html but neither work without adding #pragma GCC diagnostic ignored "-Wnonnull" to this file.

That part is now fixed by Bug 1810584.

You need to log in before you can comment on or make changes to this bug.