classification
Title: __builtin_unreachable error in gcc 4.4.5
Type: compile error Stage: resolved
Components: Build Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, lukasz.langa, miss-islington, serhiy.storchaka, vstinner, yota moteuchi
Priority: release blocker Keywords: patch

Created on 2020-09-28 11:15 by yota moteuchi, last changed 2020-10-05 16:10 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22433 merged corona10, 2020-09-28 12:58
PR 22442 merged miss-islington, 2020-09-28 20:41
Messages (8)
msg377594 - (view) Author: yota moteuchi (yota moteuchi) Date: 2020-09-28 11:15
While compiling a very recent release of Python (ie. 3.9.0rc2) with a fairly old release of gcc (ie. debian 6.0.6 gcc 4.4.5) I get the following error :

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Parser/pegen/pegen.o Parser/pegen/pegen.c

Parser/pegen/pegen.c: In function ‘_PyPegen_seq_count_dots’:
Parser/pegen/pegen.c:1414: error: implicit declaration of function ‘__builtin_unreachable’

Indeed, this '__builtin_unreachable()' function will exists starting from gcc 4.5.

The configure file could detect this and offer an alternative.

(does a table of the supported gcc release for each python versions exists ?)
msg377604 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-28 16:00
I am able to reproduce this issue on my gcc 4.4.7

ef9b356a9deb">root@ef9b356a9deb:/home/cpython# gcc --version
gcc (Ubuntu/Linaro 4.4.7-8ubuntu7) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Objects/abstract.c: In function '_PySequence_IterSearch':
Objects/abstract.c:2065: error: implicit declaration of function '__builtin_unreachable'
Makefile:1751: recipe for target 'Objects/abstract.o' failed
make: *** [Objects/abstract.o] Error 1

And with PR 22433, I am success to build and run test.


I 'd like to send backport patch into 3.9 also
msg377626 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-28 20:41
New changeset 24ba3b0df5e5f2f237d7b23b4017ba12f16320ae by Dong-hee Na in branch 'master':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/24ba3b0df5e5f2f237d7b23b4017ba12f16320ae
msg377635 - (view) Author: miss-islington (miss-islington) Date: 2020-09-28 22:16
New changeset cca896e13b230a934fdb709b7f10c5451ffc25ba by Miss Islington (bot) in branch '3.9':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/cca896e13b230a934fdb709b7f10c5451ffc25ba
msg377636 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-28 22:17
FYI __builtin_unreachable() is used since this change, of bpo-38249:

commit eebaa9bfc593d5a46b293c1abd929fbfbfd28199
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Mon Mar 9 20:49:52 2020 +0200

    bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release mode. (GH-16329)
    
    Co-authored-by: Victor Stinner <vstinner@python.org>
msg377637 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-28 22:20
Lukasz: Would you mind to cherry-pick the commit cca896e13b230a934fdb709b7f10c5451ffc25ba in 3.9.0 final?
msg377959 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-10-04 16:21
Done.
msg378049 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-10-05 16:10
New changeset df71b65a882cc9ddf9cd45ae9f83a04ec441af1e by Łukasz Langa (Miss Islington (bot)) in branch '3.9':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/df71b65a882cc9ddf9cd45ae9f83a04ec441af1e
History
Date User Action Args
2020-10-05 16:10:19lukasz.langasetmessages: + msg378049
2020-10-04 16:21:07lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg377959

stage: patch review -> resolved
2020-09-28 22:20:32vstinnersetpriority: normal -> release blocker

messages: + msg377637
2020-09-28 22:17:45vstinnersetmessages: + msg377636
2020-09-28 22:16:32miss-islingtonsetmessages: + msg377635
2020-09-28 20:41:50miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21471
2020-09-28 20:41:33corona10setmessages: + msg377626
2020-09-28 16:00:03corona10setnosy: + lukasz.langa
messages: + msg377604
2020-09-28 13:02:25corona10setversions: + Python 3.10
2020-09-28 12:59:16corona10setnosy: + vstinner, serhiy.storchaka
2020-09-28 12:58:54corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request21464
2020-09-28 12:45:30corona10setnosy: + corona10
2020-09-28 11:15:51yota moteuchicreate