[New-bugs-announce] [issue34300] gcc 7.3 causes a warning when compiling getpath.c in python 2.7

tzickel report at bugs.python.org
Tue Jul 31 15:25:15 EDT 2018


New submission from tzickel <icebreak at yahoo.com>:

When compiling on ubuntu 18.04 the 2.7 branch, I get this warning:

gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -DPYTHONPATH='":plat-linux2:lib-tk:lib-old"' \
        -DPREFIX='"/usr/local"' \
        -DEXEC_PREFIX='"/usr/local"' \
        -DVERSION='"2.7"' \
        -DVPATH='""' \
        -o Modules/getpath.o ./Modules/getpath.c
In file included from /usr/include/string.h:494:0,
                 from Include/Python.h:38,
                 from ./Modules/getpath.c:3:
In function 'strncpy',
    inlined from 'joinpath' at ./Modules/getpath.c:202:5,
    inlined from 'search_for_prefix' at ./Modules/getpath.c:265:9,
    inlined from 'calculate_path' at ./Modules/getpath.c:505:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: '__builtin_strncpy': specified size between 9223372036854779906 and 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overflow=]
   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          ^~----

I think it's because the compiler can't reason that Py_FatalError aborts the program, and thus not overflow strncpy.

Since there are about 3-4 warnings while building, maybe we should add a manual return after Py_FatalError in joinpath ?

----------
components: Build
messages: 322809
nosy: tzickel
priority: normal
severity: normal
status: open
title: gcc 7.3 causes a warning when compiling getpath.c in python 2.7
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34300>
_______________________________________


More information about the New-bugs-announce mailing list