Title: Python should be built with "gcc -fprofile-update=atomic" for PGO to fix random GCC crashes · Issue #145801 · python/cpython · GitHub
Open Graph Title: Python should be built with "gcc -fprofile-update=atomic" for PGO to fix random GCC crashes · Issue #145801 · python/cpython
X Title: Python should be built with "gcc -fprofile-update=atomic" for PGO to fix random GCC crashes · Issue #145801 · python/cpython
Description: On Fedora Rawhide, we started to get GCC crashes ("internal compiler error: Segmentation fault") in January when building Python 3.15 on AArch64 with PGO. The crash occurs randomly in the second PGO step, when building Python the second ...
Open Graph Description: On Fedora Rawhide, we started to get GCC crashes ("internal compiler error: Segmentation fault") in January when building Python 3.15 on AArch64 with PGO. The crash occurs randomly in the second PG...
X Description: On Fedora Rawhide, we started to get GCC crashes ("internal compiler error: Segmentation fault") in January when building Python 3.15 on AArch64 with PGO. The crash occurs randomly in the...
Opengraph URL: https://github.com/python/cpython/issues/145801
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python should be built with \"gcc -fprofile-update=atomic\" for PGO to fix random GCC crashes","articleBody":"On Fedora Rawhide, we [started to get GCC crashes](https://bugzilla.redhat.com/show_bug.cgi?id=2430184) (\"internal compiler error: Segmentation fault\") in January when building Python 3.15 on AArch64 with PGO. The crash occurs randomly in the second PGO step, when building Python the second time using the profile data (`-fprofile-use` uses generated `.gcda` files).\n\nExample on crash:\n\n```\ngcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -mbranch-protection=standard -fexceptions -mbranch-protection=standard -fexceptions -mbranch-protection=standard -fexceptions -O3 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -g -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -D_Py_TIER2=3 -D_Py_JIT -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -D_GNU_SOURCE -fPIC -fwrapv -O3 -fprofile-use -fprofile-correction -I/builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Include/internal -I/builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Include/internal/mimalloc -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Include -fPIC -DPy_BUILD_CORE_BUILTIN -c /builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Modules/_opcode.c -o Modules/_opcode.o\n*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.\nEvent | Plugins\nPLUGIN_FINISH_UNIT | annobin: Generate final annotations\nPLUGIN_START_UNIT | annobin: Generate global annotations\nPLUGIN_ALL_PASSES_START | annobin: Generate per-function annotations\nPLUGIN_ALL_PASSES_END | annobin: Register per-function end symbols\nduring IPA pass: profile\n/builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Modules/_opcode.c: In function ‘_opcode_has_arg’:\n/builddir/build/BUILD/python3.15-3.15.0_a7-build/Python-3.15.0a7/Modules/_opcode.c:449:1: internal compiler error: Segmentation fault\n```\n\nAccording to Jakub Jelinek who works on GCC, one explanation of this crash can be that the `.gcda` file is corrupted and building Python with [-fprofile-update=atomic](https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html) should fix that. `-fprofile-update=atomic` uses atomic operations to update profile information:\n\n> If ‘atomic’ is selected, then the profile information is updated using atomic operations on a best-effort basis. Ideally, the profile information is updated through atomic operations in hardware. If the target platform does not support the required atomic operations in hardware, however, libatomic is available, then the profile information is updated through calls to libatomic. If the target platform neither supports the required atomic operations in hardware nor libatomic, then the profile information is not atomically updated and a warning is issued. In this case, the obtained profiling information may be corrupt for multi-threaded applications.\n>\n> For performance reasons, if 64-bit counters are used for the profiling information and the target platform only supports 32-bit atomic operations in hardware, then the performance critical profiling updates are done using two 32-bit atomic operations for each counter update. If a signal interrupts these two operations updating a counter, then the profiling information may be in an inconsistent state.\n\nWhen Miro Hrončok rebuilt Python 3.15 with `-fprofile-update=atomic` 10 times, he got a success rate of 100% (10/10), whereas there is a failure rate of 30% without this option.\n\nGCC uses `-fprofile-update=prefer-atomic` when `-pthread` option is used, but (at least on Fedora) `-pthread` is not used. So GCC uses `-fprofile-update=prefer-single` by default.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-145802\n* gh-145892\n* gh-145893\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2026-03-11T10:53:09Z","url":"https://github.com/python/cpython/issues/145801"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e57eaf35-fc37-cc77-8c8b-c25c88a459fe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E8E:AFBD9:1671E80:1DA141A:6B020277 |
| html-safe-nonce | 9995360f36f588938b45a93986ea81248bf38d2f815543fddd749f348c2a261b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RThFOkFGQkQ5OjE2NzFFODA6MURBMTQxQTo2QjAyMDI3NyIsInZpc2l0b3JfaWQiOiI5MjA2MjA3OTk5NjkzMjk3ODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dcf706c297b14f55922cd74a33f7ef90920084c89f8937a90d3c28be4acd4bfa |
| hovercard-subject-tag | issue:4057465937 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/145801/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a44c1ed7127fcda11b18874f81c7ffbf1e8cc85fabf0698bde1f605a3a96409e/python/cpython/issues/145801 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a44c1ed7127fcda11b18874f81c7ffbf1e8cc85fabf0698bde1f605a3a96409e/python/cpython/issues/145801 |
| og:image:alt | On Fedora Rawhide, we started to get GCC crashes ("internal compiler error: Segmentation fault") in January when building Python 3.15 on AArch64 with PGO. The crash occurs randomly in the second PG... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width