public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115492] New: [15 Regression] wrong code at -O2/O3 when compiled with -fPIC
@ 2024-06-14 14:40 tangyixuan at mail dot dlut.edu.cn
  2024-06-14 23:59 ` [Bug tree-optimization/115492] [15 Regression] wrong code at -O2/O3 pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2024-06-14 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115492
           Summary: [15 Regression] wrong code at -O2/O3 when compiled
                    with -fPIC
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, I find that GCC-15 produces the possible wrong code when compiling the
following code with "-O3 -fPIC". However, GCC-13 could get the correct output
with the same compilation flags.

$ gcc-13 -O3 -fPIC s.c; ./a.out
0
$ gcc -O3 -fPIC s.c; ./a.out
2

$ gcc --version
gcc (GCC) 15.0.0 20240602 (experimental)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat s.c

extern int printf(const char *format, ...);
int a = 2, b=0, *c = &a, *d = &a, e=0;
void f() {}
void h(int *k) {
  int ***j;
  if (b) {
    *j = &k;
    ***j;
  }
  f(*k);
  *d = e;
  printf("%d\n",*k);
}
int main() { h(c); }

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

end of thread, other threads:[~2024-06-17 13:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 14:40 [Bug tree-optimization/115492] New: [15 Regression] wrong code at -O2/O3 when compiled with -fPIC tangyixuan at mail dot dlut.edu.cn
2024-06-14 23:59 ` [Bug tree-optimization/115492] [15 Regression] wrong code at -O2/O3 pinskia at gcc dot gnu.org
2024-06-15  0:11 ` sjames at gcc dot gnu.org
2024-06-15  0:13 ` pinskia at gcc dot gnu.org
2024-06-15  1:14 ` [Bug tree-optimization/115492] [15 Regression] wrong code at -O2/O3 since r15-204-g7c469a9fc78550 sjames at gcc dot gnu.org
2024-06-17  5:34 ` rguenth at gcc dot gnu.org
2024-06-17  7:20 ` rguenth at gcc dot gnu.org
2024-06-17 12:40 ` cvs-commit at gcc dot gnu.org
2024-06-17 13:16 ` 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).