public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
@ 2023-09-12  7:11 shaohua.li at inf dot ethz.ch
  2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-12  7:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111383
           Summary: Wrong code at -Os on x86_64-linux-gnu since
                    r12-5138-ge82c382971
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
                CC: aldyh at redhat dot com
  Target Milestone: ---

gcc at -Os produced the wrong code.

Bisected to r12-5138-ge82c382971

Compiler explorer: https://godbolt.org/z/eYY31rn4d

$ cat a.c
int printf(const char *, ...);
int a, d = 1625015426;
char e;
short b;
short *f = &b, *g = &b;
void h(char *k) {
  char c = *k;
  for (; c;)
    ;
}
int main() {
  *g = 25330;
  int i, j;
  i = 0;
  for (; *f + d - 1625040257 < 7;)
    ;
  for (; i < 4; i++) {
    j = 0;
    for (; (d - 1625015511) + (d - 1625015341) + j < 1; j++)
      h(&e);
  }
  printf("%d\n", a);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -Os a.c && ./a.out
(Timeout)
$
$ gcc -fsanitize=address,undefined a.c && ./a.out
0
$

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

end of thread, other threads:[~2023-10-20 13:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12  7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
2023-09-12 12:37 ` [Bug tree-optimization/111383] [12/13/14 Regression] " rguenth at gcc dot gnu.org
2023-09-12 16:41 ` pinskia at gcc dot gnu.org
2023-09-12 16:44 ` pinskia at gcc dot gnu.org
2023-09-12 16:46 ` pinskia at gcc dot gnu.org
2023-09-17 20:12 ` pinskia at gcc dot gnu.org
2023-10-20 13:50 ` rguenth at gcc dot gnu.org
2023-10-20 13:54 ` cvs-commit at gcc dot gnu.org
2023-10-20 13:57 ` rguenth 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).