public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/20479] New: Instruction scheduler falsely reorders insns (ia64)
@ 2005-03-15  8:20 grigory dot zagorodnev at intel dot com
  2005-03-15  8:31 ` [Bug middle-end/20479] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: grigory dot zagorodnev at intel dot com @ 2005-03-15  8:20 UTC (permalink / raw)
  To: gcc-bugs

Test listed below fails when compiled with -02 optimization at IA64. It appears 
that instruction scheduler misses dependency between two assignments in 
the 'set_code' routine and falsely reorders them.

$ cat test.c
typedef struct s_t {
  short a;
  short b;
} *ps;
 
void set_code (ps obj, short code) {
    *((int *) obj) = 0;
    obj->a = code;
}
 
int printf(const char *, ...);
int main() {
    struct s_t obj;
    set_code(&obj, 123);
    
    printf("%s: got %d, expected 123\n", 
        ((obj.a == 123)?"PASS":"FAIL"), obj.a);
}

$ gcc test.c -O2 
$ ./a.out
FAIL: got 0, expected 123

Here is the assembly code of function 'set_code' with incorrectly reordered 
instructions.

$ gcc test.c -S -O2 
        .proc set_code#
set_code:
        .prologue
        .body
        st2 [r32] = r33		;    obj->a = code;
        st4 [r32] = r0		;    *((int *) obj) = 0;
        br.ret.sptk.many b0

PS: the minimal set of optimizations reproducing the failure is "-O1 -fstrict-
aliasing -fschedule-insns".

-- 
           Summary: Instruction scheduler falsely reorders insns (ia64)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: grigory dot zagorodnev at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: ia64-redhat-linux


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


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

* [Bug middle-end/20479] Instruction scheduler falsely reorders insns (ia64)
  2005-03-15  8:20 [Bug middle-end/20479] New: Instruction scheduler falsely reorders insns (ia64) grigory dot zagorodnev at intel dot com
@ 2005-03-15  8:31 ` pinskia at gcc dot gnu dot org
  2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
  2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-15  8:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-15 08:28 -------
You are violating C89/C99/C++ aliasing rules so this is undefined.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug middle-end/20479] Instruction scheduler falsely reorders insns (ia64)
  2005-03-15  8:20 [Bug middle-end/20479] New: Instruction scheduler falsely reorders insns (ia64) grigory dot zagorodnev at intel dot com
  2005-03-15  8:31 ` [Bug middle-end/20479] " pinskia at gcc dot gnu dot org
@ 2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
  2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  9:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 09:11 -------
Reopening to ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug middle-end/20479] Instruction scheduler falsely reorders insns (ia64)
  2005-03-15  8:20 [Bug middle-end/20479] New: Instruction scheduler falsely reorders insns (ia64) grigory dot zagorodnev at intel dot com
  2005-03-15  8:31 ` [Bug middle-end/20479] " pinskia at gcc dot gnu dot org
  2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  9:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 09:11 -------
Mark as a dup of bug 21920.

*** This bug has been marked as a duplicate of 21920 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-06-05  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-15  8:20 [Bug middle-end/20479] New: Instruction scheduler falsely reorders insns (ia64) grigory dot zagorodnev at intel dot com
2005-03-15  8:31 ` [Bug middle-end/20479] " pinskia at gcc dot gnu dot org
2005-06-05  9:11 ` pinskia at gcc dot gnu dot org
2005-06-05  9:11 ` pinskia 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).