* bug#766: 23.0.60; interesting warning during compilation @ 2008-08-23 9:00 ` Peter Dyballa 2008-08-23 14:10 ` Eli Zaretskii 2008-08-27 19:10 ` bug#766: marked as done (23.0.60; interesting warning during compilation) Emacs bug Tracking System 0 siblings, 2 replies; 18+ messages in thread From: Peter Dyballa @ 2008-08-23 9:00 UTC (permalink / raw) To: emacs-pretest-bug Hello! The warning from gcc 4.0.1 is: dired.c:1003: warning: right shift count >= width of type /* To allow inode numbers beyond 32 bits, separate into 2 24-bit high parts and a 16-bit bottom part. */ EMACS_INT high_ino = s.st_ino >> 32; EMACS_INT low_ino = s.st_ino & 0xffffffff; Mac OS X 10.4.11, CVS update yesterday. -- Greetings Pete A blizzard is when it snows sideways. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 9:00 ` bug#766: 23.0.60; interesting warning during compilation Peter Dyballa @ 2008-08-23 14:10 ` Eli Zaretskii 2008-08-23 14:58 ` Peter Dyballa 2008-08-23 17:33 ` Andreas Schwab 2008-08-27 19:10 ` bug#766: marked as done (23.0.60; interesting warning during compilation) Emacs bug Tracking System 1 sibling, 2 replies; 18+ messages in thread From: Eli Zaretskii @ 2008-08-23 14:10 UTC (permalink / raw) To: Peter Dyballa, 766; +Cc: bug-gnu-emacs > From: Peter Dyballa <Peter_Dyballa@Freenet.DE> > Date: Sat, 23 Aug 2008 11:00:28 +0200 > Cc: > > The warning from gcc 4.0.1 is: > > dired.c:1003: warning: right shift count >= width of type > > /* To allow inode numbers beyond 32 bits, separate into 2 24-bit > high parts and a 16-bit bottom part. */ > EMACS_INT high_ino = s.st_ino >> 32; > EMACS_INT low_ino = s.st_ino & 0xffffffff; This happens on any system whose st_ino is 32 bits or less, because this code needs to cater to systems whose st_ino is wider than 32 bits. If someone has suggestions how to avoid this warning without making code ugly and unreadable, and preferably without system-dependent #ifdef's, I'm all ears. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 14:10 ` Eli Zaretskii @ 2008-08-23 14:58 ` Peter Dyballa 2008-08-23 17:34 ` Eli Zaretskii 2008-08-23 17:33 ` Andreas Schwab 1 sibling, 1 reply; 18+ messages in thread From: Peter Dyballa @ 2008-08-23 14:58 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs Am 23.08.2008 um 16:10 schrieb Eli Zaretskii: > This happens on any system whose st_ino is 32 bits or less, because > this code needs to cater to systems whose st_ino is wider than 32 > bits. Could it work to type-cast the variable first into a type wider than 32 bits? -- Greetings Pete No project was ever completed on time and within budget. – Cheops Law ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 14:58 ` Peter Dyballa @ 2008-08-23 17:34 ` Eli Zaretskii 2008-08-23 22:23 ` Peter Dyballa 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2008-08-23 17:34 UTC (permalink / raw) To: Peter Dyballa; +Cc: 766, bug-gnu-emacs > Cc: 766@emacsbugs.donarmstrong.com, > bug-gnu-emacs@gnu.org > From: Peter Dyballa <Peter_Dyballa@Freenet.DE> > Date: Sat, 23 Aug 2008 16:58:20 +0200 > > Could it work to type-cast the variable first into a type wider than > 32 bits? It could, if we could be sure that 64-bit wide integer types are supported on all platforms. I don't know if they are; does anyone know? (It looks like we use "long long" etc. vary sparingly and only on platform-specific files, where there's no problem knowing whether it is supported.) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 17:34 ` Eli Zaretskii @ 2008-08-23 22:23 ` Peter Dyballa 2008-08-24 3:13 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Peter Dyballa @ 2008-08-23 22:23 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs Am 23.08.2008 um 19:34 schrieb Eli Zaretskii: >> Could it work to type-cast the variable first into a type wider than >> 32 bits? > > It could, if we could be sure that 64-bit wide integer types are > supported on all platforms. I don't know if they are; does anyone > know? There aren't so many (elderly) systems left ... Besides, isn't the long long, a data type of at least 64 bits, defined in C, ANSI C99 to be exact? Actually, I think, it's sad that no compiler needs to follow this option! Another option is to check whether the size of the variable is bigger than four bytes. -- Greetings Pete Rain is saved up in cloud banks. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 22:23 ` Peter Dyballa @ 2008-08-24 3:13 ` Eli Zaretskii 2008-08-24 7:27 ` Peter Dyballa 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2008-08-24 3:13 UTC (permalink / raw) To: Peter Dyballa; +Cc: 766, bug-gnu-emacs > Cc: 766@emacsbugs.donarmstrong.com, > bug-gnu-emacs@gnu.org > From: Peter Dyballa <Peter_Dyballa@Freenet.DE> > Date: Sun, 24 Aug 2008 00:23:29 +0200 > > Another option is to check whether the size of the variable is bigger > than four bytes. If you mean with sizeof, then the problem is that sizeof is not a preprocessing-time operator, so it cannot prevent the compiler from seeing the offending code. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-24 3:13 ` Eli Zaretskii @ 2008-08-24 7:27 ` Peter Dyballa 2008-08-24 18:12 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Peter Dyballa @ 2008-08-24 7:27 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs Am 24.08.2008 um 05:13 schrieb Eli Zaretskii: > If you mean with sizeof, then the problem is that sizeof is not a > preprocessing-time operator, so it cannot prevent the compiler from > seeing the offending code. You mean if (sizeof (s.st_ino) > 4) introducing the shift operation will fail to keep the compiler from emitting the warning? Anyway, I think Andreas Schwab's proposition to split the one wide shift into two shorter ones is better. And the original code relies on an undefined behaviour of every compiler, which might change. -- Greetings Pete No project was ever completed on time and within budget. – Cheops Law ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-24 7:27 ` Peter Dyballa @ 2008-08-24 18:12 ` Eli Zaretskii 0 siblings, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2008-08-24 18:12 UTC (permalink / raw) To: Peter Dyballa; +Cc: 766, bug-gnu-emacs > Cc: 766@emacsbugs.donarmstrong.com, > bug-gnu-emacs@gnu.org > From: Peter Dyballa <Peter_Dyballa@Freenet.DE> > Date: Sun, 24 Aug 2008 09:27:16 +0200 > > > Am 24.08.2008 um 05:13 schrieb Eli Zaretskii: > > > If you mean with sizeof, then the problem is that sizeof is not a > > preprocessing-time operator, so it cannot prevent the compiler from > > seeing the offending code. > > You mean > > if (sizeof (s.st_ino) > 4) > > introducing the shift operation will fail to keep the compiler from > emitting the warning? Yes, it will fail. Please try compiling this toy program on a 32-bit machine, and you will see the same warning. int foo (int a) { if (sizeof (a) > 4) return a >> 32; else return 0; } > Anyway, I think Andreas Schwab's proposition to split the one wide > shift into two shorter ones is better. I agree, I just wanted to be sure that this won't bring the same warning back at some future time. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 14:10 ` Eli Zaretskii 2008-08-23 14:58 ` Peter Dyballa @ 2008-08-23 17:33 ` Andreas Schwab 2008-08-23 18:18 ` Eli Zaretskii 1 sibling, 1 reply; 18+ messages in thread From: Andreas Schwab @ 2008-08-23 17:33 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs, Peter Dyballa Eli Zaretskii <eliz@gnu.org> writes: > If someone has suggestions how to avoid this warning without making > code ugly and unreadable, and preferably without system-dependent > #ifdef's, I'm all ears. EMACS_INT high_ino = s.st_ino >> 31 >> 1; Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 17:33 ` Andreas Schwab @ 2008-08-23 18:18 ` Eli Zaretskii 2008-08-23 18:56 ` Andreas Schwab 2008-09-03 18:47 ` Stefan Monnier 0 siblings, 2 replies; 18+ messages in thread From: Eli Zaretskii @ 2008-08-23 18:18 UTC (permalink / raw) To: Andreas Schwab; +Cc: 766, bug-gnu-emacs, Peter_Dyballa > From: Andreas Schwab <schwab@suse.de> > Cc: 766@emacsbugs.donarmstrong.com, > Peter Dyballa <Peter_Dyballa@Freenet.DE>, bug-gnu-emacs@gnu.org > Date: Sat, 23 Aug 2008 19:33:22 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > If someone has suggestions how to avoid this warning without making > > code ugly and unreadable, and preferably without system-dependent > > #ifdef's, I'm all ears. > > EMACS_INT high_ino = s.st_ino >> 31 >> 1; Thanks. Can we be reasonably sure that GCC will not become smart enough some day to flag this as well? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 18:18 ` Eli Zaretskii @ 2008-08-23 18:56 ` Andreas Schwab 2008-08-23 19:06 ` Eli Zaretskii 2008-09-03 18:47 ` Stefan Monnier 1 sibling, 1 reply; 18+ messages in thread From: Andreas Schwab @ 2008-08-23 18:56 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs, Peter_Dyballa Eli Zaretskii <eliz@gnu.org> writes: >> From: Andreas Schwab <schwab@suse.de> >> EMACS_INT high_ino = s.st_ino >> 31 >> 1; > > Thanks. Can we be reasonably sure that GCC will not become smart > enough some day to flag this as well? What do you mean with "smart enough"? There is nothing to flag here. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 18:56 ` Andreas Schwab @ 2008-08-23 19:06 ` Eli Zaretskii 2008-08-23 20:03 ` Andreas Schwab 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2008-08-23 19:06 UTC (permalink / raw) To: Andreas Schwab; +Cc: 766, bug-gnu-emacs, Peter_Dyballa > From: Andreas Schwab <schwab@suse.de> > Cc: 766@emacsbugs.donarmstrong.com, Peter_Dyballa@Freenet.DE, > bug-gnu-emacs@gnu.org > Date: Sat, 23 Aug 2008 20:56:38 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> From: Andreas Schwab <schwab@suse.de> > >> EMACS_INT high_ino = s.st_ino >> 31 >> 1; > > > > Thanks. Can we be reasonably sure that GCC will not become smart > > enough some day to flag this as well? > > What do you mean with "smart enough"? Maybe that was a polite way of saying "silly enough". > There is nothing to flag here. I meant the warning about shifting by too many bits. 31+1 = 32, and even a compiler can realize that. Please don't get me wrong: I will gladly make the change as you suggested, I just don't want us to bump into this again a few GCC upgrades down the road. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 19:06 ` Eli Zaretskii @ 2008-08-23 20:03 ` Andreas Schwab 2008-08-23 20:50 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Andreas Schwab @ 2008-08-23 20:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs, Peter_Dyballa Eli Zaretskii <eliz@gnu.org> writes: > I meant the warning about shifting by too many bits. 31+1 = 32, and > even a compiler can realize that. That's not how the shift operator is defined. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 20:03 ` Andreas Schwab @ 2008-08-23 20:50 ` Eli Zaretskii 2008-08-23 23:12 ` Andreas Schwab 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2008-08-23 20:50 UTC (permalink / raw) To: Andreas Schwab; +Cc: 766, bug-gnu-emacs, Peter_Dyballa > From: Andreas Schwab <schwab@suse.de> > Cc: 766@emacsbugs.donarmstrong.com, Peter_Dyballa@Freenet.DE, > bug-gnu-emacs@gnu.org > Date: Sat, 23 Aug 2008 22:03:31 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > I meant the warning about shifting by too many bits. 31+1 = 32, and > > even a compiler can realize that. > > That's not how the shift operator is defined. Andreas, it's late and I'm tired. Could you please answer my question, which is: what is the danger, if any, that GCC in some future version will produce the same warning for the code you suggested? Thanks in advance. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 20:50 ` Eli Zaretskii @ 2008-08-23 23:12 ` Andreas Schwab 2008-08-24 3:14 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Andreas Schwab @ 2008-08-23 23:12 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 766, bug-gnu-emacs, Peter_Dyballa Eli Zaretskii <eliz@gnu.org> writes: > Andreas, it's late and I'm tired. Could you please answer my > question, which is: what is the danger, if any, that GCC in some > future version will produce the same warning for the code you > suggested? I have already answered that question. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 23:12 ` Andreas Schwab @ 2008-08-24 3:14 ` Eli Zaretskii 0 siblings, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2008-08-24 3:14 UTC (permalink / raw) To: Andreas Schwab; +Cc: 766, bug-gnu-emacs, Peter_Dyballa > From: Andreas Schwab <schwab@suse.de> > Cc: 766@emacsbugs.donarmstrong.com, Peter_Dyballa@Freenet.DE, > bug-gnu-emacs@gnu.org > Date: Sun, 24 Aug 2008 01:12:55 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > Andreas, it's late and I'm tired. Could you please answer my > > question, which is: what is the danger, if any, that GCC in some > > future version will produce the same warning for the code you > > suggested? > > I have already answered that question. In that case, I didn't understand it. Just for me, could you please translate it into a simple YES or NO: is there a danger that GCC will in the future produce the same warning for your suggested code? Thanks. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: 23.0.60; interesting warning during compilation 2008-08-23 18:18 ` Eli Zaretskii 2008-08-23 18:56 ` Andreas Schwab @ 2008-09-03 18:47 ` Stefan Monnier 1 sibling, 0 replies; 18+ messages in thread From: Stefan Monnier @ 2008-09-03 18:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Andreas Schwab, 766, Peter_Dyballa, bug-gnu-emacs >> > If someone has suggestions how to avoid this warning without making >> > code ugly and unreadable, and preferably without system-dependent >> > #ifdef's, I'm all ears. >> >> EMACS_INT high_ino = s.st_ino >> 31 >> 1; > Thanks. Can we be reasonably sure that GCC will not become smart > enough some day to flag this as well? I don't think anybody can guarantee it, but usually it's a bad idea to output warnings about post-optimization code, so you may hope that GCC will optimize "x >> 31 >> 1" to "x >> 32" without ever outputing a warning about the silliness of the end result. Then again, the present code shows that even outputting a warning about "x >> 32" is already borderline annoying, so there's no guarantee gcc won't become more annoying in the future. Stefan ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#766: marked as done (23.0.60; interesting warning during compilation) 2008-08-23 9:00 ` bug#766: 23.0.60; interesting warning during compilation Peter Dyballa 2008-08-23 14:10 ` Eli Zaretskii @ 2008-08-27 19:10 ` Emacs bug Tracking System 1 sibling, 0 replies; 18+ messages in thread From: Emacs bug Tracking System @ 2008-08-27 19:10 UTC (permalink / raw) To: Chong Yidong [-- Attachment #1: Type: text/plain, Size: 862 bytes --] Your message dated Wed, 27 Aug 2008 15:05:59 -0400 with message-id <87k5e2uvl4.fsf@cyd.mit.edu> and subject line Re: bug#766: 23.0.60; interesting warning during compilation has caused the Emacs bug report #766, regarding 23.0.60; interesting warning during compilation to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) -- 766: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=766 Emacs Bug Tracking System Contact don@donarmstrong.com with problems [-- Attachment #2: Type: message/rfc822, Size: 2728 bytes --] From: Peter Dyballa <Peter_Dyballa@Freenet.DE> To: emacs-pretest-bug@gnu.org Subject: 23.0.60; interesting warning during compilation Date: Sat, 23 Aug 2008 11:00:28 +0200 Message-ID: <4762603A-B23E-454E-A43C-422DE5036DC4@Freenet.DE> Hello! The warning from gcc 4.0.1 is: dired.c:1003: warning: right shift count >= width of type /* To allow inode numbers beyond 32 bits, separate into 2 24-bit high parts and a 16-bit bottom part. */ EMACS_INT high_ino = s.st_ino >> 32; EMACS_INT low_ino = s.st_ino & 0xffffffff; Mac OS X 10.4.11, CVS update yesterday. -- Greetings Pete A blizzard is when it snows sideways. [-- Attachment #3: Type: message/rfc822, Size: 967 bytes --] From: Chong Yidong <cyd@stupidchicken.com> To: 766-done@emacsbugs.donarmstrong.com Subject: Re: bug#766: 23.0.60; interesting warning during compilation Date: Wed, 27 Aug 2008 15:05:59 -0400 Message-ID: <87k5e2uvl4.fsf@cyd.mit.edu> I've checked in Andreas' fix. ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2008-09-03 18:47 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <87k5e2uvl4.fsf@cyd.mit.edu> 2008-08-23 9:00 ` bug#766: 23.0.60; interesting warning during compilation Peter Dyballa 2008-08-23 14:10 ` Eli Zaretskii 2008-08-23 14:58 ` Peter Dyballa 2008-08-23 17:34 ` Eli Zaretskii 2008-08-23 22:23 ` Peter Dyballa 2008-08-24 3:13 ` Eli Zaretskii 2008-08-24 7:27 ` Peter Dyballa 2008-08-24 18:12 ` Eli Zaretskii 2008-08-23 17:33 ` Andreas Schwab 2008-08-23 18:18 ` Eli Zaretskii 2008-08-23 18:56 ` Andreas Schwab 2008-08-23 19:06 ` Eli Zaretskii 2008-08-23 20:03 ` Andreas Schwab 2008-08-23 20:50 ` Eli Zaretskii 2008-08-23 23:12 ` Andreas Schwab 2008-08-24 3:14 ` Eli Zaretskii 2008-09-03 18:47 ` Stefan Monnier 2008-08-27 19:10 ` bug#766: marked as done (23.0.60; interesting warning during compilation) Emacs bug Tracking System
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.