Compiling the code in the main.i attachment with -march=i686 -O2 the code
generated for the "first_map_occurred" is bigger for 4.1 compared to 4.0
The sdiff between 4.0 and 4.1:

xorl    %eax, %eax                     |   xorl    %ecx, %ecx
movl    %eax, waiting_for_initial_map  |   movl    %ecx, waiting_for_initial_map


Trying to minimize the testcase changes the code generated for 4.1
It is a bit worse. 


typedef struct {
  int max_col;
  int max_row;


} TScreen;


typedef struct _XtermWidgetRec {
    TScreen screen;
} XtermWidgetRec, *XtermWidget;



static int cp_pipe[2];


static int pc_pipe[2];
typedef enum {
    PTY_BAD,
    PTY_FATALERROR,
    PTY_GOOD,
    PTY_NEW,
    PTY_NOMORE,
    UTMP_ADDED,
    UTMP_TTYSLOT,
    PTY_EXEC
} status_t;

typedef struct {
    status_t status;
    int error;
    int fatal_error;
    int tty_slot;
    int rows;
    int cols;
    char buffer[1024];
} handshake_t;

extern XtermWidget term;
extern int waiting_for_initial_map;

__extension__ typedef int __ssize_t;

typedef __ssize_t ssize_t;
typedef unsigned int size_t;


extern ssize_t write (int __fd, __const void *__buf, size_t __n) ;
extern int close (int __fd);

void
first_map_occurred(void)
{
    handshake_t handshake;
    TScreen *screen = &term->screen;

    handshake.status = PTY_EXEC;
    handshake.rows = screen->max_row;
    handshake.cols = screen->max_col;
    write(pc_pipe[1], (char *) &handshake, sizeof(handshake));
    close(cp_pipe[0]);
    close(pc_pipe[1]);
    waiting_for_initial_map = 0;
}

This is one of the reasons for the code size regression in PR23153.

-- 
           Summary: code size regression on x86
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to