public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu
@ 2024-05-26 21:12 zhendong.su at inf dot ethz.ch
  2024-05-26 21:24 ` [Bug tree-optimization/115236] [15 regression] Wrong " sjames at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2024-05-26 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115236
           Summary: wrong code at -O1 and above with -fno-tree-fre on
                    x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression as it doesn't reproduce with 14.1 and
earlier. 

Compiler Explorer: https://godbolt.org/z/xhY65cevr

[533] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240526 (experimental) (GCC) 
[534] % 
[534] % gcctk -O1 small.c; ./a.out
[535] % 
[535] % gcctk -O1 -fno-tree-fre small.c
[536] % ./a.out
Aborted
[537] % cat small.c
int a, *b = &a;
int main() {
  int *c, *volatile *d = &c;
  *d = b;
  if (c != &a)
    __builtin_abort();
  return 0;
}

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
@ 2024-05-26 21:24 ` sjames at gcc dot gnu.org
  2024-05-26 21:25 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-26 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|wrong code at -O1 and above |[15 regression] Wrong code
                   |with -fno-tree-fre on       |at -O1 and above with
                   |x86_64-linux-gnu            |-fno-tree-fre on
                   |                            |x86_64-linux-gnu
                 CC|                            |sjames at gcc dot gnu.org
           Keywords|                            |wrong-code

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
--- a/foo.c.051t.sccopy1
+++ b/foo.c.051t.sccopy1
@@ -1,6 +1,8 @@

;; Function main (main, funcdef_no=0, decl_uid=2770, cgraph_uid=1,
symbol_order=2)

{+Removing basic block 4+}
{+Merging blocks 2 and 3+}
int main ()
{
  int * volatile * d;
@@ -16,20 +18,9 @@ int main ()
  MEM[(int * volatile *)&c] ={v} b.0_1;
  # DEBUG BEGIN_STMT
  c.1_2 = c;
[-  if (c.1_2 != &a)-]
[-    goto <bb 3>; [INV]-]
[-  else-]
[-    goto <bb 4>; [INV]-]

[-  <bb 3> :-]
  # DEBUG BEGIN_STMT
  __builtin_abort ();

[-  <bb 4> :-]
[-  # DEBUG BEGIN_STMT-]
[-  c ={v} {CLOBBER(eos)};-]
[-  return 0;-]

}

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2024-05-26 21:24 ` [Bug tree-optimization/115236] [15 regression] Wrong " sjames at gcc dot gnu.org
@ 2024-05-26 21:25 ` pinskia at gcc dot gnu.org
  2024-05-26 22:22 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c sjames at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-26 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[15 regression] Wrong code  |[15 regression] Wrong code
                   |at -O1 and above with       |at -O1 and above with
                   |-fno-tree-fre on            |-fno-tree-fre and volatile
                   |x86_64-linux-gnu            |pointers
            Version|unknown                     |15.0
   Target Milestone|---                         |15.0

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2024-05-26 21:24 ` [Bug tree-optimization/115236] [15 regression] Wrong " sjames at gcc dot gnu.org
  2024-05-26 21:25 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers pinskia at gcc dot gnu.org
@ 2024-05-26 22:22 ` sjames at gcc dot gnu.org
  2024-05-26 23:12 ` sjames at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-26 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
            Summary|[15 regression] Wrong code  |[15 regression] Wrong code
                   |at -O1 and above with       |at -O1 and above with
                   |-fno-tree-fre and volatile  |-fno-tree-fre and volatile
                   |pointers                    |pointers since
                   |                            |r15-579-ga9251ab3c91c8c

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
r15-579-ga9251ab3c91c8c

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2024-05-26 22:22 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c sjames at gcc dot gnu.org
@ 2024-05-26 23:12 ` sjames at gcc dot gnu.org
  2024-05-27  7:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-26 23:12 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-05-26
     Ever confirmed|0                           |1

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2024-05-26 23:12 ` sjames at gcc dot gnu.org
@ 2024-05-27  7:18 ` rguenth at gcc dot gnu.org
  2024-05-27  8:39 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-27  7:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interesting more of STOREDANYTHING not working.  Mine.

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2024-05-27  7:18 ` rguenth at gcc dot gnu.org
@ 2024-05-27  8:39 ` rguenth at gcc dot gnu.org
  2024-05-28 12:35 ` cvs-commit at gcc dot gnu.org
  2024-05-28 12:36 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-27  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The main issue is that 'c' is a direct node by means of copying the address to

  MEM[(int * volatile *)&c] ={v} b.0_1;

that makes us not apply STOREDANYTHING to it.  It's not exactly clear why
we should excempt direct nodes here, that's probably a mistake.

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2024-05-27  8:39 ` rguenth at gcc dot gnu.org
@ 2024-05-28 12:35 ` cvs-commit at gcc dot gnu.org
  2024-05-28 12:36 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-28 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:c08b0d3f7b3539b26031de31d88dea6b94474577

commit r15-861-gc08b0d3f7b3539b26031de31d88dea6b94474577
Author: Richard Biener <rguenther@suse.de>
Date:   Mon May 27 10:41:02 2024 +0200

    tree-optimization/115236 - more points-to *ANYTHING = x fixes

    The stored-to ANYTHING handling has more holes, uncovered by treating
    volatile accesses as ANYTHING.  We fail to properly build the
    pred and succ graphs, in particular we may not elide direct nodes
    from receiving from STOREDANYTHING.

            PR tree-optimization/115236
            * tree-ssa-structalias.cc (build_pred_graph): Properly
            handle *ANYTHING = X.
            (build_succ_graph): Likewise.  Do not elide direct nodes
            from receiving from STOREDANYTHING.

            * gcc.dg/pr115236.c: New testcase.

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

* [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c
  2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (6 preceding siblings ...)
  2024-05-28 12:35 ` cvs-commit at gcc dot gnu.org
@ 2024-05-28 12:36 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-28 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should now finally be fixed.  Thanks for the report.

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

end of thread, other threads:[~2024-05-28 12:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-26 21:12 [Bug tree-optimization/115236] New: wrong code at -O1 and above with -fno-tree-fre on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2024-05-26 21:24 ` [Bug tree-optimization/115236] [15 regression] Wrong " sjames at gcc dot gnu.org
2024-05-26 21:25 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers pinskia at gcc dot gnu.org
2024-05-26 22:22 ` [Bug tree-optimization/115236] [15 regression] Wrong code at -O1 and above with -fno-tree-fre and volatile pointers since r15-579-ga9251ab3c91c8c sjames at gcc dot gnu.org
2024-05-26 23:12 ` sjames at gcc dot gnu.org
2024-05-27  7:18 ` rguenth at gcc dot gnu.org
2024-05-27  8:39 ` rguenth at gcc dot gnu.org
2024-05-28 12:35 ` cvs-commit at gcc dot gnu.org
2024-05-28 12:36 ` 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).