* Compilation warning in simple-object-xcoff.c @ 2018-01-16 17:48 Eli Zaretskii 2018-01-16 18:01 ` DJ Delorie 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2018-01-16 17:48 UTC (permalink / raw) To: gcc-patches; +Cc: gdb-patches Compiling GDB 8.0.91 with mingw.org's MinGW GCC 6.0.3 produces this warning in libiberty: gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS -I. -I./../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -D_GNU_SOURCE ./simple-object-xcoff.c -o simple-object-xcoff.o ./simple-object-xcoff.c: In function 'simple_object_xcoff_find_sections': ./simple-object-xcoff.c:605:25: warning: left shift count >= width of type [-Wshift-count-overflow] x_scnlen = x_scnlen << 32 ^~ And indeed x_scnlen is declared as a 32-bit data type off_t. I'm willing to test patches if needed. Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-16 17:48 Compilation warning in simple-object-xcoff.c Eli Zaretskii @ 2018-01-16 18:01 ` DJ Delorie 2018-01-16 18:38 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: DJ Delorie @ 2018-01-16 18:01 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gcc-patches, gdb-patches I think that warning is valid - the host has a 32-bit limit to file sizes (off_t) but it's trying to read a 64-bit offset (in that clause). It's warning you that you won't be able to handle files as large as the field implies. Can we hide the warning? Probably. Should we? Debatable, as long as we want 64-bit xcoff support in 32-bit filesystems. Otherwise, we'd need to detect off_t overflow somehow, down the slippery slope of reporting the error to the caller... ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-16 18:01 ` DJ Delorie @ 2018-01-16 18:38 ` Eli Zaretskii 2018-01-16 18:43 ` DJ Delorie 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2018-01-16 18:38 UTC (permalink / raw) To: DJ Delorie; +Cc: gcc-patches, gdb-patches > From: DJ Delorie <dj@redhat.com> > Cc: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > Date: Tue, 16 Jan 2018 13:00:48 -0500 > > > I think that warning is valid - the host has a 32-bit limit to file > sizes (off_t) but it's trying to read a 64-bit offset (in that clause). > It's warning you that you won't be able to handle files as large as the > field implies. If 32-bit off_t cannot handle this, then perhaps this file (or that function) should not be compiled for a 32-bit host? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-16 18:38 ` Eli Zaretskii @ 2018-01-16 18:43 ` DJ Delorie 2018-01-16 22:20 ` Andreas Schwab 0 siblings, 1 reply; 11+ messages in thread From: DJ Delorie @ 2018-01-16 18:43 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gcc-patches, gdb-patches Well, it should all work fine as long as the xcoff64 file is less than 4 Gb. And it's not the host's bit size that counts; there are usually ways to get 64-bit file operations on 32-bit hosts. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-16 18:43 ` DJ Delorie @ 2018-01-16 22:20 ` Andreas Schwab 2018-01-17 15:38 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Andreas Schwab @ 2018-01-16 22:20 UTC (permalink / raw) To: DJ Delorie; +Cc: Eli Zaretskii, gcc-patches, gdb-patches On Jan 16 2018, DJ Delorie <dj@redhat.com> wrote: > And it's not the host's bit size that counts; there are usually ways to > get 64-bit file operations on 32-bit hosts. If ACX_LARGEFILE doesn't succeed in enabling those 64-bit file operations (thus making off_t a 64-bit type) then you are out of luck (or AC_SYS_LARGEFILE doesn't support your host yet). Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-16 22:20 ` Andreas Schwab @ 2018-01-17 15:38 ` Eli Zaretskii 2018-01-17 21:10 ` DJ Delorie 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2018-01-17 15:38 UTC (permalink / raw) To: Andreas Schwab; +Cc: dj, gcc-patches, gdb-patches > From: Andreas Schwab <schwab@linux-m68k.org> > Cc: Eli Zaretskii <eliz@gnu.org>, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > Date: Tue, 16 Jan 2018 23:00:55 +0100 > > On Jan 16 2018, DJ Delorie <dj@redhat.com> wrote: > > > And it's not the host's bit size that counts; there are usually ways to > > get 64-bit file operations on 32-bit hosts. > > If ACX_LARGEFILE doesn't succeed in enabling those 64-bit file > operations (thus making off_t a 64-bit type) then you are out of luck > (or AC_SYS_LARGEFILE doesn't support your host yet). Yes, AC_SYS_LARGEFILE doesn't support MinGW. DJ, would the following semi-kludgey workaround be acceptable? --- libiberty/simple-object-xcoff.c~0 2018-01-12 05:31:04.000000000 +0200 +++ libiberty/simple-object-xcoff.c 2018-01-17 12:21:08.496186000 +0200 @@ -596,13 +596,19 @@ simple_object_xcoff_find_sections (simpl aux = (unsigned char *) auxent; if (u64) { + /* Use an intermediate 64-bit type to avoid + compilation warning about 32-bit shift below on + hosts with 32-bit off_t which aren't supported by + AC_SYS_LARGEFILE. */ + ulong_type x_scnlen64; + if ((auxent->u.xcoff64.x_csect.x_smtyp & 0x7) != XTY_SD || auxent->u.xcoff64.x_csect.x_smclas != XMC_XO) continue; - x_scnlen = fetch_32 (aux + offsetof (union external_auxent, - u.xcoff64.x_csect.x_scnlen_hi)); - x_scnlen = x_scnlen << 32 + x_scnlen64 = fetch_32 (aux + offsetof (union external_auxent, + u.xcoff64.x_csect.x_scnlen_hi)); + x_scnlen = x_scnlen64 << 32 | fetch_32 (aux + offsetof (union external_auxent, u.xcoff64.x_csect.x_scnlen_lo)); } ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-17 15:38 ` Eli Zaretskii @ 2018-01-17 21:10 ` DJ Delorie 2018-01-18 4:25 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: DJ Delorie @ 2018-01-17 21:10 UTC (permalink / raw) To: Eli Zaretskii; +Cc: schwab, gcc-patches, gdb-patches Eli Zaretskii <eliz@gnu.org> writes: > DJ, would the following semi-kludgey workaround be acceptable? It would be no worse than what we have now, if the only purpose is to avoid a warning. Ideally, we would check to see if we're discarding non-zero values from that offset, and not call the callback with known bogus data. I suppose the usefulness of that depends on how often you'll encounter 4Gb+ xcoff64 files on mingw32 ? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-17 21:10 ` DJ Delorie @ 2018-01-18 4:25 ` Eli Zaretskii 2018-01-20 13:12 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2018-01-18 4:25 UTC (permalink / raw) To: DJ Delorie; +Cc: schwab, gcc-patches, gdb-patches > From: DJ Delorie <dj@redhat.com> > Cc: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > Date: Wed, 17 Jan 2018 15:47:49 -0500 > > Eli Zaretskii <eliz@gnu.org> writes: > > > DJ, would the following semi-kludgey workaround be acceptable? > > It would be no worse than what we have now, if the only purpose is to > avoid a warning. > > Ideally, we would check to see if we're discarding non-zero values from > that offset, and not call the callback with known bogus data. I suppose > the usefulness of that depends on how often you'll encounter 4Gb+ xcoff64 > files on mingw32 ? The answer to that question is "never", AFAIU. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-18 4:25 ` Eli Zaretskii @ 2018-01-20 13:12 ` Eli Zaretskii 2018-01-21 6:41 ` Ian Lance Taylor via gcc-patches 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2018-01-20 13:12 UTC (permalink / raw) To: dj; +Cc: gcc-patches, gdb-patches > Date: Thu, 18 Jan 2018 05:25:20 +0200 > From: Eli Zaretskii <eliz@gnu.org> > CC: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > > > From: DJ Delorie <dj@redhat.com> > > Cc: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > > Date: Wed, 17 Jan 2018 15:47:49 -0500 > > > > Eli Zaretskii <eliz@gnu.org> writes: > > > > > DJ, would the following semi-kludgey workaround be acceptable? > > > > It would be no worse than what we have now, if the only purpose is to > > avoid a warning. > > > > Ideally, we would check to see if we're discarding non-zero values from > > that offset, and not call the callback with known bogus data. I suppose > > the usefulness of that depends on how often you'll encounter 4Gb+ xcoff64 > > files on mingw32 ? > > The answer to that question is "never", AFAIU. So can the patch I proposed be applied, please? TIA ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-20 13:12 ` Eli Zaretskii @ 2018-01-21 6:41 ` Ian Lance Taylor via gcc-patches 2018-01-21 19:13 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Ian Lance Taylor via gcc-patches @ 2018-01-21 6:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: DJ Delorie, gcc-patches, gdb-patches On Sat, Jan 20, 2018 at 4:47 AM, Eli Zaretskii <eliz@gnu.org> wrote: >> Date: Thu, 18 Jan 2018 05:25:20 +0200 >> From: Eli Zaretskii <eliz@gnu.org> >> CC: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org >> >> > From: DJ Delorie <dj@redhat.com> >> > Cc: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org >> > Date: Wed, 17 Jan 2018 15:47:49 -0500 >> > >> > Eli Zaretskii <eliz@gnu.org> writes: >> > >> > > DJ, would the following semi-kludgey workaround be acceptable? >> > >> > It would be no worse than what we have now, if the only purpose is to >> > avoid a warning. >> > >> > Ideally, we would check to see if we're discarding non-zero values from >> > that offset, and not call the callback with known bogus data. I suppose >> > the usefulness of that depends on how often you'll encounter 4Gb+ xcoff64 >> > files on mingw32 ? >> >> The answer to that question is "never", AFAIU. > > So can the patch I proposed be applied, please? I committed the patch. Ian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Compilation warning in simple-object-xcoff.c 2018-01-21 6:41 ` Ian Lance Taylor via gcc-patches @ 2018-01-21 19:13 ` Eli Zaretskii 0 siblings, 0 replies; 11+ messages in thread From: Eli Zaretskii @ 2018-01-21 19:13 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: dj, gcc-patches, gdb-patches > From: Ian Lance Taylor <iant@google.com> > Date: Sat, 20 Jan 2018 21:01:09 -0800 > Cc: DJ Delorie <dj@redhat.com>, gcc-patches <gcc-patches@gcc.gnu.org>, > gdb-patches <gdb-patches@sourceware.org> > > On Sat, Jan 20, 2018 at 4:47 AM, Eli Zaretskii <eliz@gnu.org> wrote: > >> Date: Thu, 18 Jan 2018 05:25:20 +0200 > >> From: Eli Zaretskii <eliz@gnu.org> > >> CC: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > >> > >> > From: DJ Delorie <dj@redhat.com> > >> > Cc: schwab@linux-m68k.org, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org > >> > Date: Wed, 17 Jan 2018 15:47:49 -0500 > >> > > >> > Eli Zaretskii <eliz@gnu.org> writes: > >> > > >> > > DJ, would the following semi-kludgey workaround be acceptable? > >> > > >> > It would be no worse than what we have now, if the only purpose is to > >> > avoid a warning. > >> > > >> > Ideally, we would check to see if we're discarding non-zero values from > >> > that offset, and not call the callback with known bogus data. I suppose > >> > the usefulness of that depends on how often you'll encounter 4Gb+ xcoff64 > >> > files on mingw32 ? > >> > >> The answer to that question is "never", AFAIU. > > > > So can the patch I proposed be applied, please? > > I committed the patch. Thanks, Ian! ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-01-21 15:44 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-01-16 17:48 Compilation warning in simple-object-xcoff.c Eli Zaretskii 2018-01-16 18:01 ` DJ Delorie 2018-01-16 18:38 ` Eli Zaretskii 2018-01-16 18:43 ` DJ Delorie 2018-01-16 22:20 ` Andreas Schwab 2018-01-17 15:38 ` Eli Zaretskii 2018-01-17 21:10 ` DJ Delorie 2018-01-18 4:25 ` Eli Zaretskii 2018-01-20 13:12 ` Eli Zaretskii 2018-01-21 6:41 ` Ian Lance Taylor via gcc-patches 2018-01-21 19:13 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).