public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28726]  New: -fsched2-use-superblock produces wrong code
@ 2006-08-14 17:56 sg313d at gmail dot com
  2006-08-16  6:17 ` [Bug rtl-optimization/28726] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: sg313d at gmail dot com @ 2006-08-14 17:56 UTC (permalink / raw)
  To: gcc-bugs

-fsched2-use-superblocks fails to order loop operations and loop jump
instruction correctly. The following example will show that
-fsched2-use-superblocks causes generation of wrong code.

Steps to reproduce:
Compile
>>>
#include <string.h>
#include <stdio.h>

int main()
{
        double retval = 0.0;
        const unsigned char *start = "\005\b\000";
        unsigned int len = strlen(start);
        const unsigned char *const end = start + len;
        while (start < end) {
            retval += *(start++);
        }
        printf("%lf\n", retval);
        return 0;
}
<<<
with -O2 -fsched2-use-superblocks -> Observe that 8.000 is printed (incorrect)
and with -O2 -> Observe that 13.000 is printed (correct)
Examining the generated assemblies, it shows that the loop does not include
the add operation:
>>> (loop code for -O2 -fsched2-use-superblocks)
.L10:
        fstp    %st(0)
.L5:
        movzbl  (%edx), %eax
        incl    %edx
        pushl   %eax
        fildl   (%esp)
        addl    $4, %esp
        cmpl    %edx, %ecx
        ja      .L10          <- this seems one instruction to early
        faddp   %st, %st(1)      
<<<
I'm not much into assembly, but i thought you might want to have a look at it.


-- 
           Summary: -fsched2-use-superblock produces wrong code
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sg313d at gmail dot com
 GCC build triplet: gcc-4.1.1/vanilla
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
@ 2006-08-16  6:17 ` pinskia at gcc dot gnu dot org
  2006-09-10 12:26 ` [Bug rtl-optimization/28726] [4.1 regression] " ebotcazou at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-16  6:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-16 06:17 -------
This is a latent bug on the mainline, the loop is fully optimized out by the
time we get to the scheduler.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.2.0                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
  2006-08-16  6:17 ` [Bug rtl-optimization/28726] " pinskia at gcc dot gnu dot org
@ 2006-09-10 12:26 ` ebotcazou at gcc dot gnu dot org
  2006-09-10 12:26 ` ebotcazou at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-10 12:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2006-09-10 12:26 -------
Investigating.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-09-10 12:26:19         |2006-09-10 12:26:42
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
  2006-08-16  6:17 ` [Bug rtl-optimization/28726] " pinskia at gcc dot gnu dot org
  2006-09-10 12:26 ` [Bug rtl-optimization/28726] [4.1 regression] " ebotcazou at gcc dot gnu dot org
@ 2006-09-10 12:26 ` ebotcazou at gcc dot gnu dot org
  2006-09-10 16:59 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-10 12:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ebotcazou at gcc dot gnu dot org  2006-09-10 12:26 -------
Works with 4.0.4pre so regression on 4.1 branch.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|gcc-4.1.1/vanilla           |i686-pc-linux-gnu
      Known to fail|                            |4.1.2
      Known to work|                            |4.0.4 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-10 12:26:19
               date|                            |
            Summary|-fsched2-use-superblock     |[4.1 regression] -fsched2-
                   |produces wrong code         |use-superblock produces
                   |                            |wrong code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (2 preceding siblings ...)
  2006-09-10 12:26 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-10 16:59 ` jsm28 at gcc dot gnu dot org
  2006-09-11 19:28 ` ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2006-09-10 16:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (3 preceding siblings ...)
  2006-09-10 16:59 ` jsm28 at gcc dot gnu dot org
@ 2006-09-11 19:28 ` ebotcazou at gcc dot gnu dot org
  2006-09-11 19:29 ` ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-11 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ebotcazou at gcc dot gnu dot org  2006-09-11 19:28 -------
Subject: Bug 28726

Author: ebotcazou
Date: Mon Sep 11 19:28:11 2006
New Revision: 116855

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116855
Log:
        PR rtl-optimization/28726
        * sched-deps.c (sched_analyze_reg): New function extracted from...
        (sched_analyze_1): ...here.  Call it to analyze references to
        registers.  Treat again writes to a stack register as writing to the
        register.
        (sched_analyze_2): ...and here.  Call it to analyze references to
        registers.  Treat again reads of a stack register as reading the
        register.


Added:
    trunk/gcc/testsuite/gcc.dg/pr28726.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/sched-deps.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (4 preceding siblings ...)
  2006-09-11 19:28 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-11 19:29 ` ebotcazou at gcc dot gnu dot org
  2006-09-11 19:32 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-11 19:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ebotcazou at gcc dot gnu dot org  2006-09-11 19:28 -------
Subject: Bug 28726

Author: ebotcazou
Date: Mon Sep 11 19:28:41 2006
New Revision: 116856

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116856
Log:
        PR rtl-optimization/28726
        * sched-deps.c (sched_analyze_reg): New function extracted from...
        (sched_analyze_1): ...here.  Call it to analyze references to
        registers.  Treat again writes to a stack register as writing to the
        register.
        (sched_analyze_2): ...and here.  Call it to analyze references to
        registers.  Treat again reads of a stack register as reading the
        register.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr28726.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/sched-deps.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (5 preceding siblings ...)
  2006-09-11 19:29 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-11 19:32 ` ebotcazou at gcc dot gnu dot org
  2006-09-11 20:58 ` sg313d at gmail dot com
  2006-09-11 23:01 ` ebotcazou at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-11 19:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ebotcazou at gcc dot gnu dot org  2006-09-11 19:32 -------
Fixed in upcoming 4.1.2 release.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |09/msg00415.html
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (6 preceding siblings ...)
  2006-09-11 19:32 ` ebotcazou at gcc dot gnu dot org
@ 2006-09-11 20:58 ` sg313d at gmail dot com
  2006-09-11 23:01 ` ebotcazou at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: sg313d at gmail dot com @ 2006-09-11 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from sg313d at gmail dot com  2006-09-11 20:57 -------
Thank you for the fix. And for serving the GCC to the community. :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

* [Bug rtl-optimization/28726] [4.1 regression] -fsched2-use-superblock produces wrong code
  2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
                   ` (7 preceding siblings ...)
  2006-09-11 20:58 ` sg313d at gmail dot com
@ 2006-09-11 23:01 ` ebotcazou at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-11 23:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ebotcazou at gcc dot gnu dot org  2006-09-11 23:01 -------
> Thank you for the fix. And for serving the GCC to the community. :)

You're welcome.  Thanks for reporting the problem and for the nice testcase.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28726


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

end of thread, other threads:[~2006-09-11 23:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-14 17:56 [Bug c/28726] New: -fsched2-use-superblock produces wrong code sg313d at gmail dot com
2006-08-16  6:17 ` [Bug rtl-optimization/28726] " pinskia at gcc dot gnu dot org
2006-09-10 12:26 ` [Bug rtl-optimization/28726] [4.1 regression] " ebotcazou at gcc dot gnu dot org
2006-09-10 12:26 ` ebotcazou at gcc dot gnu dot org
2006-09-10 16:59 ` jsm28 at gcc dot gnu dot org
2006-09-11 19:28 ` ebotcazou at gcc dot gnu dot org
2006-09-11 19:29 ` ebotcazou at gcc dot gnu dot org
2006-09-11 19:32 ` ebotcazou at gcc dot gnu dot org
2006-09-11 20:58 ` sg313d at gmail dot com
2006-09-11 23:01 ` ebotcazou at gcc dot gnu dot 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).