public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear
@ 2014-10-20 11:30 asolokha at gmx dot com
  2014-10-21  4:58 ` [Bug tree-optimization/63602] " asolokha at gmx dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: asolokha at gmx dot com @ 2014-10-20 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63602
           Summary: Wrong code w/ -O2 -ftree-loop-linear
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com

gcc produces wrong code w/ -ftree-loop-linear -O2 (and above) for the following
reduced case:

int sx;
int bn;
int vz = 1;
int *volatile n6 = &bn;

int
main(void)
{
  for (int i = 0; i < 3; ++i) {
    sx = vz;
    vz = bn;
  }
  return sx;
}

It struck me first w/ gcc-4.10.0-alpha20140810, but today I've reproduced it w/
4.8.3, 4.9.1 and 5-alpha20141019, so I'm not marking it as a regression.

Expected results:
% gcc-5.0_alpha20141019 -O2 -o good 963b8772.c
% ./good
% echo $?
0

Actual results:
% gcc-5.0_alpha20141019 -O2 -ftree-loop-linear -o bad 963b8772.c
% ./bad
% echo $?
1


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

* [Bug tree-optimization/63602] Wrong code w/ -O2 -ftree-loop-linear
  2014-10-20 11:30 [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear asolokha at gmx dot com
@ 2014-10-21  4:58 ` asolokha at gmx dot com
  2015-05-13 10:54 ` [Bug tree-optimization/63602] [5/6 Regression] " asolokha at gmx dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: asolokha at gmx dot com @ 2014-10-21  4:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Arseny Solokha <asolokha at gmx dot com> ---
It seems I've reduced the snippet too hard. However, are global variables
declared static or not, it doesn't change anything.


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

* [Bug tree-optimization/63602] [5/6 Regression] Wrong code w/ -O2 -ftree-loop-linear
  2014-10-20 11:30 [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear asolokha at gmx dot com
  2014-10-21  4:58 ` [Bug tree-optimization/63602] " asolokha at gmx dot com
@ 2015-05-13 10:54 ` asolokha at gmx dot com
  2015-08-19 12:28 ` bernd.edlinger at hotmail dot de
  2015-10-16  8:28 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: asolokha at gmx dot com @ 2015-05-13 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

Arseny Solokha <asolokha at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.2
            Summary|Wrong code w/ -O2           |[5/6 Regression] Wrong code
                   |-ftree-loop-linear          |w/ -O2 -ftree-loop-linear
      Known to fail|4.8.3, 4.9.1, 5.0           |5.1.0, 6.0

--- Comment #2 from Arseny Solokha <asolokha at gmx dot com> ---
I've just checked it and found that gcc 4.9.2 compiles it correctly. So,
relabelling as a regression.


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

* [Bug tree-optimization/63602] [5/6 Regression] Wrong code w/ -O2 -ftree-loop-linear
  2014-10-20 11:30 [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear asolokha at gmx dot com
  2014-10-21  4:58 ` [Bug tree-optimization/63602] " asolokha at gmx dot com
  2015-05-13 10:54 ` [Bug tree-optimization/63602] [5/6 Regression] " asolokha at gmx dot com
@ 2015-08-19 12:28 ` bernd.edlinger at hotmail dot de
  2015-10-16  8:28 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2015-08-19 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #3 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
BTW: same results for gcc-5.1.0 with isl-0.12.2:

gcc -floop-block -O2 pr63602.c
gcc -floop-interchange -O2 pr63602.c
gcc -floop-parallelize-all -O2 pr63602.c
gcc -floop-strip-mine -O2 pr63602.c

even worse:

gcc -floop-unroll-and-jam -O2 pr63602.c
../../gcc-5.1.0/isl/isl_ctx.c:172: isl_ctx freed, but some objects still
reference it
pr63602.c: In function 'main':
pr63602.c:7:1: internal compiler error: Aborted
 main(void)
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug tree-optimization/63602] [5/6 Regression] Wrong code w/ -O2 -ftree-loop-linear
  2014-10-20 11:30 [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2015-08-19 12:28 ` bernd.edlinger at hotmail dot de
@ 2015-10-16  8:28 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-16  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.3


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

end of thread, other threads:[~2015-10-16  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20 11:30 [Bug tree-optimization/63602] New: Wrong code w/ -O2 -ftree-loop-linear asolokha at gmx dot com
2014-10-21  4:58 ` [Bug tree-optimization/63602] " asolokha at gmx dot com
2015-05-13 10:54 ` [Bug tree-optimization/63602] [5/6 Regression] " asolokha at gmx dot com
2015-08-19 12:28 ` bernd.edlinger at hotmail dot de
2015-10-16  8:28 ` 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).