public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/46460] New: shifting producing incorrect result @ 2010-11-13 5:32 keefeg at gmail dot com 2010-11-13 6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: keefeg at gmail dot com @ 2010-11-13 5:32 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460 Summary: shifting producing incorrect result Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: keefeg@gmail.com % cat bug.c #include <stdio.h> int main(void) { unsigned int ShouldBeZero; int cnt = 32; ShouldBeZero = 0xFFFFFFFF >> cnt; printf("Should print 0 here: %u\n", ShouldBeZero); return 0; } % cc -o bug bug.c % ./bug Should print 0 here: 4294967295 % cc -o bug -O3 bug.c % ./bug Should print 0 here: 0 % gcc -v Using built-in specs. Target: amd64-undermydesk-freebsd Configured with: FreeBSD/amd64 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] % sysctl -a | grep 'hw\.model' hw.model: AMD Phenom(tm) II X4 955 Processor ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46460] shifting producing incorrect result 2010-11-13 5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com @ 2010-11-13 6:53 ` pinskia at gcc dot gnu.org 2010-11-13 15:10 ` [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined manu at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2010-11-13 6:53 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-13 05:31:15 UTC --- Shifting more than the bits in the (promoted) type is undefined. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined 2010-11-13 5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com 2010-11-13 6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org @ 2010-11-13 15:10 ` manu at gcc dot gnu.org 2010-11-17 9:45 ` schwab@linux-m68k.org 2014-04-29 13:06 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: manu at gcc dot gnu.org @ 2010-11-13 15:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460 Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Keywords| |diagnostic Last reconfirmed| |2010.11.13 15:06:51 CC| |manu at gcc dot gnu.org Resolution|INVALID | Ever Confirmed|0 |1 Summary|shifting producing |warn for shifting more than |incorrect result |the bits in the (promoted) | |type is undefined Severity|normal |enhancement --- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2010-11-13 15:06:51 UTC --- REOPEN as enhancement request for a warning. (No warning in 4.4.3) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined 2010-11-13 5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com 2010-11-13 6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org 2010-11-13 15:10 ` [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined manu at gcc dot gnu.org @ 2010-11-17 9:45 ` schwab@linux-m68k.org 2014-04-29 13:06 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: schwab@linux-m68k.org @ 2010-11-17 9:45 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460 Andreas Schwab <schwab@linux-m68k.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lepinat at free dot fr --- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> 2010-11-17 09:45:16 UTC --- *** Bug 46517 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined 2010-11-13 5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com ` (2 preceding siblings ...) 2010-11-17 9:45 ` schwab@linux-m68k.org @ 2014-04-29 13:06 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2014-04-29 13:06 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46460 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |mpolacek at gcc dot gnu.org Resolution|--- |FIXED --- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- We have -fsanitize=shift for this now. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-29 13:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-11-13 5:32 [Bug c/46460] New: shifting producing incorrect result keefeg at gmail dot com 2010-11-13 6:53 ` [Bug c/46460] " pinskia at gcc dot gnu.org 2010-11-13 15:10 ` [Bug c/46460] warn for shifting more than the bits in the (promoted) type is undefined manu at gcc dot gnu.org 2010-11-17 9:45 ` schwab@linux-m68k.org 2014-04-29 13:06 ` mpolacek at gcc dot gnu.org
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).