aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.h
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2020-08-11 18:20:58 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 15:08:03 -0300
commit6f32ea957f088f905e53965d881874fb50bdd3c3 (patch)
tree018843e2cf3ae5531bdbe5bc60046ecdcb7e9204 /gcc/fortran/trans-array.h
parent12bacf7f83a2fb1dfc97bec565b3cd597f96bed5 (diff)
downloadgcc-6f32ea957f088f905e53965d881874fb50bdd3c3.zip
gcc-6f32ea957f088f905e53965d881874fb50bdd3c3.tar.gz
gcc-6f32ea957f088f905e53965d881874fb50bdd3c3.tar.bz2
[nvptx] Fix array dimension in nvptx_assemble_decl_begin
When compiling test-case builtin-object-size-21.c, cc1 emits: ... .visible .global .align 1 .u32 xm3_3[-2305843009213693951] = ... for: ... struct Ax_m3 { char a[PTRDIFF_MAX - 3], ax[]; }; struct Ax_m3 xm3_3 = { { 0 }, { 1, 2, 3 } }; ... Fix this by: - changing the printing format for unsigned HOST_WIDE_INT init_frag.remaining to HOST_WIDE_INT_PRINT_UNSIGNED - changing the type of local variable elt_size in nvptx_assemble_decl_begin to unsigned HOST_WIDE_INT. such that we have: ... .visible .global .align 1 .u32 xm3_3[2305843009213693952] = ... where 2305843009213693952 == 0x2000000000000000, so the array is claiming 0x8000000000000000 bytes, which is one more than PTRDIFF_MAX. This is due to using .u32 instead of .u8, so strictly speaking we should downgrade to using .u8 in this case, but that corner-case problem doesn't look urgent enough to fix in this commit. Build on nvptx, tested with make check-gcc. gcc/ChangeLog: * config/nvptx/nvptx.c (nvptx_assemble_decl_begin): Make elt_size an unsigned HOST_WIDE_INT. Print init_frag.remaining using HOST_WIDE_INT_PRINT_UNSIGNED.
Diffstat (limited to 'gcc/fortran/trans-array.h')
0 files changed, 0 insertions, 0 deletions