Hi! On 2021-07-19T10:46:35+0200, I wrote: > | On 7/16/21 11:42 AM, Thomas Schwinge wrote: > |> On 2021-07-09T17:11:25-0600, Martin Sebor via Gcc-patches wrote: > |>> The attached tweak avoids the new -Warray-bounds instances when > |>> building libatomic for arm. Christophe confirms it resolves > |>> the problem (thank you!) > |> > |> As Abid has just reported in > |> , similar > |> problem with GCN target libgomp build: > |> > |> In function ‘gcn_thrs’, > |> inlined from ‘gomp_thread’ at [...]/source-gcc/libgomp/libgomp.h:803:10, > |> inlined from ‘GOMP_barrier’ at [...]/source-gcc/libgomp/barrier.c:34:29: > |> [...]/source-gcc/libgomp/libgomp.h:792:10: error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds] > |> 792 | return *thrs; > |> | ^~~~~ > |> > |> gcc/config/gcn/gcn.h: c_register_addr_space ("__lds", ADDR_SPACE_LDS); \ > |> > |> libgomp/libgomp.h-static inline struct gomp_thread *gcn_thrs (void) > |> libgomp/libgomp.h-{ > |> libgomp/libgomp.h- /* The value is at the bottom of LDS. */ > |> libgomp/libgomp.h: struct gomp_thread * __lds *thrs = (struct gomp_thread * __lds *)4; > |> libgomp/libgomp.h- return *thrs; > |> libgomp/libgomp.h-} > |> > |> ..., plus a few more. Work-around: > |> > |> struct gomp_thread * __lds *thrs = (struct gomp_thread * __lds *)4; > |> +# pragma GCC diagnostic push > |> +# pragma GCC diagnostic ignored "-Warray-bounds" > |> return *thrs; > |> +# pragma GCC diagnostic pop > |> > |> ..., but it's a bit tedious to add that in all that the other places, > |> too. > > Wasn't so bad after all; a lot of duplicates due to 'libgomp.h'. I've > thus pushed "[gcn] Work-around libgomp 'error: array subscript 0 is > outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ > [-Werror=array-bounds]' [PR101484]" to master branch in commit > 9f2bc5077debef2b046b6c10d38591ac324ad8b5, see attached. As I should find, these '#pragma GCC diagnostic [...]' directives cause some code generation changes (that seems unexpected, problematic!). (Martin, any idea? Might be a pre-existing problem, of course.) This results in a lot (ten thousands) of 'GCN team arena exhausted' run-time diagnostics, also leading to a few FAILs: PASS: libgomp.c/../libgomp.c-c++-common/for-11.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-11.c execution test PASS: libgomp.c/../libgomp.c-c++-common/for-12.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-12.c execution test PASS: libgomp.c/../libgomp.c-c++-common/for-3.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-3.c execution test PASS: libgomp.c/../libgomp.c-c++-common/for-5.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-5.c execution test PASS: libgomp.c/../libgomp.c-c++-common/for-6.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-6.c execution test PASS: libgomp.c/../libgomp.c-c++-common/for-9.c (test for excess errors) [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-9.c execution test Same for 'libgomp.c++'. It remains to be analyzed how '#pragma GCC diagnostic [...]' directives can cause code generation changes; for now I'm working around the "unexpected" '-Werror=array-bounds' diagnostics differently: > |> (So I'll consider some GCN-specific '-Wno-array-bounds' if we don't > |> get to resolve this otherwise, soon.) '-Wno-error=array-bounds', precisely. I've now pushed "[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' some more [PR101484]" to master branch in commit 8168338684fc2bed576bb09202c63b3e9e678d92, see attached. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955