Discussion:
Porting to GCC 6 (was: fhandler_dsp.cc error: nonnull argument ‘this’ compared to NULL)
Yaakov Selkowitz
2017-09-11 23:48:30 UTC
Permalink
Redirecting to cygwin-developers, as we don't have a patch yet.
Getting failure building latest git with current gcc 6.3
There are more:

/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/crt0.c: In function
'mainCRTStartup':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/crt0.c:23:3: error:
calling '__builtin_return_address' with a nonzero argument is unsafe
[-Werror=frame-address]
(void)__builtin_return_address(1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: ***
[/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/../Makefile.common:44:
crt0.o] Error 1
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/init.cc: In function
'void threadfunc_fe(void*)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/init.cc:26:36:
error: calling 'void* __builtin_return_address(unsigned int)' with a
nonzero argument is unsafe [-Werror=frame-address]
(void)__builtin_return_address(1);
^
make[3]: ***
[/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/../Makefile.common:41:
init.o] Error 1
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc: In
member function 'void
fhandler_dev_dsp::Audio_out::buf_info(audio_buf_info*, int, int, int)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc:503:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (this && dev_)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc: In
member function 'void
fhandler_dev_dsp::Audio_in::buf_info(audio_buf_info*, int, int, int)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc:960:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (this && dev_)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'bool _pinfo::exists()':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:532:32:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
return this && process_state && !(process_state & (PID_EXITED |
PID_REAPED | PID_EXECED));

~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'commune_result _pinfo::commune_request(__uint32_t, ...)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:723:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'fhandler_pipe* _pinfo::pipe_fhandler(int64_t, size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:822:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::fd(int, size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:835:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::fds(size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:859:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::root(size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:887:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::cwd(size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:933:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::cmdline(size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:979:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
function 'char* _pinfo::environ(size_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc:1039:3:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/signal.cc: In member
function 'int _pinfo::kill(siginfo_t&)':
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/signal.cc:263:8:
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
else if (this && process_state == PID_EXITED)
^~
cc1plus: all warnings being treated as errors

Note that commit 0008bdea02b690ab19ffe997499cb9a96ee5a66d was intended
to fix the nonnull-compare errors but had to be reverted.
--
Yaakov
Ken Brown
2017-09-17 02:00:57 UTC
Permalink
Post by Yaakov Selkowitz
Redirecting to cygwin-developers, as we don't have a patch yet.
Getting failure building latest git with current gcc 6.3
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/crt0.c: In function
calling '__builtin_return_address' with a nonzero argument is unsafe
[-Werror=frame-address]
(void)__builtin_return_address(1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: ***
crt0.o] Error 1
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/init.cc: In function
error: calling 'void* __builtin_return_address(unsigned int)' with a
nonzero argument is unsafe [-Werror=frame-address]
(void)__builtin_return_address(1);
^
make[3]: ***
init.o] Error 1
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc: In
member function 'void
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (this && dev_)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/fhandler_dsp.cc: In
member function 'void
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (this && dev_)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
return this && process_state && !(process_state & (PID_EXITED |
PID_REAPED | PID_EXECED));
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/pinfo.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
if (!this || !pid)
^~
/home/Yaakov/src/cygwin/newlib-cygwin/winsup/cygwin/signal.cc: In member
error: nonnull argument 'this' compared to NULL [-Werror=nonnull-compare]
else if (this && process_state == PID_EXITED)
^~
cc1plus: all warnings being treated as errors
Note that commit 0008bdea02b690ab19ffe997499cb9a96ee5a66d was intended
to fix the nonnull-compare errors but had to be reverted.
I think I may have fixed this. I found some errors in that commit.
After fixing the errors, the zsh problem that caused the commit to be
reverted was gone. Of course there still could be some errors that I
missed and that will show up later.

To simplify future debugging if there are further errors, I've broken
the fix up into several commits that I'll send to cygwin-patches shortly.

Ken

Loading...