Title: Spurious `-Warray-bounds` warning on GCC 11 in free-threaded build · Issue #122974 · python/cpython · GitHub
Open Graph Title: Spurious `-Warray-bounds` warning on GCC 11 in free-threaded build · Issue #122974 · python/cpython
X Title: Spurious `-Warray-bounds` warning on GCC 11 in free-threaded build · Issue #122974 · python/cpython
Description: After #122418, GCC 11+ now emits a (spurious) warning in optimized builds, but not debug builds. Clang does not issue a warning Objects/longobject.c: In function ‘_PyLong_FromMedium’: ./Include/internal/pycore_object.h:310:19: warning: a...
Open Graph Description: After #122418, GCC 11+ now emits a (spurious) warning in optimized builds, but not debug builds. Clang does not issue a warning Objects/longobject.c: In function ‘_PyLong_FromMedium’: ./Include/int...
X Description: After #122418, GCC 11+ now emits a (spurious) warning in optimized builds, but not debug builds. Clang does not issue a warning Objects/longobject.c: In function ‘_PyLong_FromMedium’: ./Include/int...
Opengraph URL: https://github.com/python/cpython/issues/122974
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Spurious `-Warray-bounds` warning on GCC 11 in free-threaded build","articleBody":"After https://github.com/python/cpython/pull/122418, GCC 11+ now emits a (spurious) warning in optimized builds, but not debug builds. Clang does not issue a warning\r\n\r\n```\r\nObjects/longobject.c: In function ‘_PyLong_FromMedium’:\r\n./Include/internal/pycore_object.h:310:19: warning: array subscript ‘PyHeapTypeObject {aka struct _heaptypeobject}[0]’ is partly outside array bounds of ‘PyTypeObject[1]’ {aka ‘struct _typeobject[1]’} [-Warray-bounds]\r\n 310 | if ((size_t)ht->unique_id \u003c (size_t)tstate->types.size) {\r\n | ~~^~~~~~~~~~~\r\nOjects/longobject.c:6596:14: note: while referencing ‘PyLong_Type’\r\n 6596 | PyTypeObject PyLong_Type = {\r\n | ^~~~~~~~~~~\r\n```\r\n\r\nGCC is clever enough to inline the `_Py_INCREF_TYPE` call on `PyLong_Type`, but not clever enough to understand the `_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)` guard.\r\n\r\nhttps://github.com/python/cpython/blob/db6f5e193315a3bbfa7b0b6644203bae3f76b638/Include/internal/pycore_object.h#L296-L322\r\n\r\nI don't see a great way to rewrite `_Py_INCREF_TYPE` to avoid the warning, so maybe we should just use a `#pragma` to suppress the `Warray-bounds` warnings in that function.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-123071\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/colesbury","@type":"Person","name":"colesbury"},"datePublished":"2024-08-13T15:31:30Z","url":"https://github.com/python/cpython/issues/122974"}
| 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:f8745467-ee69-86c5-a1be-268359489145 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E32:1ED8:18F846:254EB2:6B022F56 |
| html-safe-nonce | 1a5dc4710a896358842d9ff23b8dffeace8551be9d5a3a10556780369a488dd8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTMyOjFFRDg6MThGODQ2OjI1NEVCMjo2QjAyMkY1NiIsInZpc2l0b3JfaWQiOiIzMjAzOTU3MjMxMzY0MjIyODA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0fd2017678913d6c163830c0982c53e0327384188427654f05a12819036f668e |
| hovercard-subject-tag | issue:2463643146 |
| 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/122974/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5714feeb8a746d6993528a01ac68f8006fcd397d27e6030e27deac38f720ce11/python/cpython/issues/122974 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5714feeb8a746d6993528a01ac68f8006fcd397d27e6030e27deac38f720ce11/python/cpython/issues/122974 |
| og:image:alt | After #122418, GCC 11+ now emits a (spurious) warning in optimized builds, but not debug builds. Clang does not issue a warning Objects/longobject.c: In function ‘_PyLong_FromMedium’: ./Include/int... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | colesbury |
| 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