public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25985]  New: with optimization integer math fails
@ 2006-01-26 23:13 jurka at ejurka dot com
  2006-01-26 23:28 ` [Bug middle-end/25985] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jurka at ejurka dot com @ 2006-01-26 23:13 UTC (permalink / raw)
  To: gcc-bugs

gcc version 4.2.0 20060121

With optimzation the following code skips the last loop iteration:

#include <stdio.h>

int main(void)
{
        int bits = 25;
        while (bits) {
                printf("bits=%d\n",bits);
                if (bits >= 8) {
                        bits -= 8;
                } else {
                        bits = 0;
                }

        }
        return 0;
}

jurka@fred:~/pg/test$ ~/gcc/42/bin/gcc  ip2.c 
jurka@fred:~/pg/test$ ./a.out 
bits=25
bits=17
bits=9
bits=1
jurka@fred:~/pg/test$ ~/gcc/42/bin/gcc -O ip2.c 
jurka@fred:~/pg/test$ ./a.out 
bits=25
bits=17
bits=9
jurka@fred:~/pg/test$


-- 
           Summary: with optimization integer math fails
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jurka at ejurka dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25985


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-05-04  6:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-26 23:13 [Bug c/25985] New: with optimization integer math fails jurka at ejurka dot com
2006-01-26 23:28 ` [Bug middle-end/25985] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-02-20 17:50 ` [Bug tree-optimization/25985] " pinskia at gcc dot gnu dot org
2006-03-15 18:27 ` pinskia at gcc dot gnu dot org
2006-03-15 18:40 ` pinskia at gcc dot gnu dot org
2006-03-15 20:15 ` rguenth at gcc dot gnu dot org
2006-03-15 20:22 ` rakdver at gcc dot gnu dot org
2006-03-16  2:49 ` rakdver at gcc dot gnu dot org
2006-03-16  3:15 ` rakdver at gcc dot gnu dot org
2006-03-16 14:29 ` rakdver at gcc dot gnu dot org
2006-03-29  1:41 ` rakdver at gcc dot gnu dot org
2006-04-11 23:13 ` pinskia at gcc dot gnu dot org
2006-05-04  6:40 ` jakub at gcc dot gnu dot 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).