public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/10992] New: invalid instruction reordering with -O2 / -fschedule-insns2
@ 2003-05-27  9:08 rgrosseboerger@dspace.de
  2003-05-27  9:12 ` [Bug optimization/10992] " rgrosseboerger@dspace.de
  2003-06-02 22:53 ` bangerth@dealii.org
  0 siblings, 2 replies; 3+ messages in thread
From: rgrosseboerger@dspace.de @ 2003-05-27  9:08 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: invalid instruction reordering with -O2 / -fschedule-
                    insns2
           Product: gcc
           Version: 3.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P2
         Component: optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rgrosseboerger@dspace.de
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

GCC 3.2.x and 3.3 generate incorrect code for the simple test case below.


The problems occurs, if the C code is compiled with -O2, but does not occur 


at -O1 or "-O2 -fno-schedule-insns2" (->GCC does invalid instruction reordering 
?).


The problem disappears, if uint_value is declared as volatile. 




The correct output for the test program is :


   uint_value : 00570047  , value 00570047


...


   uint_value : 006B005B  , value 006B005B




Whereas the miscompilation with -O2 gives :


   uint_value : 00570047  , value BFFFF8E8


...


   uint_value : 006B005B  , value 00660056




I have the same problem on gcc/x86-64, but the code works OK with the Intel 
compiler.






#include <stdio.h>




typedef unsigned int UInt32;


typedef unsigned int UInt16;


typedef float         Float32;




float  f_array[25];


UInt32 u32_array[25];


int j = 5;




inline void func(UInt32 count, UInt32* address, volatile Float32* float_value)


{


    unsigned int i;


    UInt16 value_low = 0x42;


    UInt16 value_high = 0x52;


    /*volatile*/  UInt32 uint_value;


    


    for (i = 0; i < count; i++)


    {  


        value_high = value_high +5;


        value_low = value_low +5;


        


        uint_value = (((UInt32)value_high) << 16);


        uint_value |= value_low;


        


        float_value[i] = *((volatile float*)(&uint_value));




        printf("   uint_value : %08X  , value %08X \n", uint_value, *((UInt32 *) 
&(float_value[i])));


    }


}




int main()


{


    func( j, u32_array , f_array);     


}



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10992] invalid instruction reordering with -O2 / -fschedule-insns2
  2003-05-27  9:08 [Bug optimization/10992] New: invalid instruction reordering with -O2 / -fschedule-insns2 rgrosseboerger@dspace.de
@ 2003-05-27  9:12 ` rgrosseboerger@dspace.de
  2003-06-02 22:53 ` bangerth@dealii.org
  1 sibling, 0 replies; 3+ messages in thread
From: rgrosseboerger@dspace.de @ 2003-05-27  9:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rgrosseboerger@dspace.de changed:

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


------- Additional Comments From rgrosseboerger@dspace.de  2003-05-27 09:01 -------


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



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10992] invalid instruction reordering with -O2 / -fschedule-insns2
  2003-05-27  9:08 [Bug optimization/10992] New: invalid instruction reordering with -O2 / -fschedule-insns2 rgrosseboerger@dspace.de
  2003-05-27  9:12 ` [Bug optimization/10992] " rgrosseboerger@dspace.de
@ 2003-06-02 22:53 ` bangerth@dealii.org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth@dealii.org @ 2003-06-02 22:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth@dealii.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |11070





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2003-06-02 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-27  9:08 [Bug optimization/10992] New: invalid instruction reordering with -O2 / -fschedule-insns2 rgrosseboerger@dspace.de
2003-05-27  9:12 ` [Bug optimization/10992] " rgrosseboerger@dspace.de
2003-06-02 22:53 ` bangerth@dealii.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).