help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

g++ 3.4.1 -O2 problem on HP-UX 10.20


From: Ralf Fassel
Subject: g++ 3.4.1 -O2 problem on HP-UX 10.20
Date: Mon, 13 Sep 2004 13:08:55 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux)

gcc/g++ 3.4.1, HP-UX 10.20

compiling with -O2 leads to repeated invocation of a function call,
-O1 or -O runs ok.

The C++ code in question looks like this (snipped down to show the
strcuture):

    int rt_command_level::compute(){
      int    ierg,   num_chan;
      ...
      ierg = src_data[0]->get_run_out_channel_prior(...);
      if(RT_DATA_RETURN_OK==ierg) {
        if(len_avail>0) {
           ...
           if(len_out>0) {
            ...
            // some more calls which assign and check ierg
            ...
            if(RT_DATA_RETURN_OK!=ierg) return ierg;
    #if 0
            // this code is OK with -freorder-blocks
            int iret;
            iret = src_data[0]->set_out_data_read_done(...);
            if(RT_DATA_RETURN_OK!=iret) return iret;
    #else
            // this code fails with -freorder-blocks
*           ierg = src_data[0]->set_out_data_read_done(...);
            if(RT_DATA_RETURN_OK!=ierg) return ierg;
    #endif
          }  // len_out>0
        } // len_avail>0
      }// OK
      ...
      return ierg;
    }

The symptom is that the program loops at the line marked "*",
re-invoking the function again and again, until the return-value is
not RT_DATA_RETURN_OK.  Note that there is no loop programmed here,
neither `while' nor `for'.

The behaviour is unchanged in gcc 3.4.2, it was not observed with gcc
2.7.2.1.  I have check the bugs database and found some references for
bad optimizations on HP-UX, but it seems the above was not related to
these.

Any hints?  .s and .ii output available if it helps...

R'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]