public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65357] New: aggressive loop optimization not correct
@ 2015-03-09  2:26 weiming at ms1 dot url.com.tw
  2015-03-09  4:18 ` [Bug c/65357] " trippels at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: weiming at ms1 dot url.com.tw @ 2015-03-09  2:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65357

            Bug ID: 65357
           Summary: aggressive loop optimization not correct
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: weiming at ms1 dot url.com.tw

source:

#include <stdio.h>
#include <stdlib.h>

void    addlist(int n, int *list)
{
    int    i;
    for (i=0; i<n; i++)
    {
        *list++=*list+10;
        *list++=*list+11;
    }
}

int    tlist[10]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

void    main(void)
{
    int    i;
    addlist(5, tlist);
    for (i=0; i<10; i++)
    {
        fprintf(stdout, "%d: %d\n", i, tlist[i]);
    }
}

makefile:
tt.exe: tt.c
    gcc -O3 -o $@ $<

result of gcc 4.7.3:
0: 10
1: 12
2: 12
3: 14
4: 14
5: 16
6: 16
7: 18
8: 18
9: 20

result of gcc 4.8.4 and 4.9.2:
0: 11
1: 13
2: 13
3: 15
4: 15
5: 17
6: 17
7: 19
8: 19
9: 11

which is correct?


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

end of thread, other threads:[~2015-03-09  8:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09  2:26 [Bug c/65357] New: aggressive loop optimization not correct weiming at ms1 dot url.com.tw
2015-03-09  4:18 ` [Bug c/65357] " trippels at gcc dot gnu.org
2015-03-09  5:08 ` pinskia at gcc dot gnu.org
2015-03-09  5:47 ` weiming at ms1 dot url.com.tw
2015-03-09  6:14 ` weiming at ms1 dot url.com.tw
2015-03-09  8:33 ` jakub at gcc dot gnu.org
2015-03-09  8:47 ` pinskia 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).