Bug 40414 - gcc 4.4.0 error at postreload.c:396
Summary: gcc 4.4.0 error at postreload.c:396
Status: RESOLVED DUPLICATE of bug 37053
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P5 normal
Target Milestone: 4.4.6
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 40415 (view as bug list)
Depends on: 37053 41064
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-11 13:33 UTC by bernd_afa
Modified: 2010-11-01 16:40 UTC (History)
3 users (show)

See Also:
Host: cygwin-i686
Target: m68k-amigaos
Build: cygwin-i686
Known to work: 4.5.0
Known to fail:
Last reconfirmed: 2009-12-29 19:30:43


Attachments
preprocessed file -O3 (43.93 KB, text/plain)
2009-08-17 20:11 UTC, ami_stuff
Details
asm output -O3 (3.38 KB, text/plain)
2009-08-17 20:11 UTC, ami_stuff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bernd_afa 2009-06-11 13:33:51 UTC
its find out, the problematic optimization that crash seem "-funswitch-loops". A compile 
of ffmpeg with -O2 + all other optimization options from -O3 work, (see second output)

See also the Mail i write before

http://gcc.gnu.org/ml/gcc/2009-06/msg00229.html

$ make_68k_v4
/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.0.exe -V 4.4.0
-DHAVE_AV_CONFIG_H -I..
 -I"/bin/ffmpeg8" --save-temps -mnobitfield -m68060 -std=c99
-Wdeclaration-afte
r-statement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE
-D_POSIX_C_
SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common
-fomit-fram
e-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls
-Wcast-qual -Wwrit
e-strings -Wundef -O3 -c -o mpegvideo.o mpegvideo.c
mpegvideo.c: In function 'init_rl':
mpegvideo.c:760: warning: pointer targets in assignment differ in
signedness
mpegvideo.c:765: warning: pointer targets in assignment differ in
signedness
mpegvideo.c: In function 'MPV_motion_lowres':
mpegvideo.c:1707: error: insn does not satisfy its constraints:
(insn 937 3765 3766 59 mpegvideo.c:1488 (set (reg:SI 0 d0 [931])
        (plus:SI (mem/f:SI (reg:SI 9 a1) [7 S4 A16])
            (reg:SI 0 d0 [931]))) 131 {*addsi3_internal} (nil))
mpegvideo.c:1707: internal compiler error: in
reload_cse_simplify_operands, at p
ostreload.c:396
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

------------------------------------------------------------------------

Compiles fine with -O2 + all optimalizations from -O3 except
"-funswitch-loops":

$ make_68k_v4
/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.0.exe -V 4.4.0
-DHAVE_AV_CONFIG_H -I..
 -I"/bin/ffmpeg8" --save-temps -mnobitfield -m68060 -std=c99
-Wdeclaration-afte
r-statement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE
-D_POSIX_C_
SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common
-fomit-fram
e-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls
-Wcast-qual -Wwrit
e-strings -Wundef -O2 -finline-functions -fgcse-after-reload
-fpredictive-common
ing -ftree-vectorize -c -o mpegvideo.o mpegvideo.c
mpegvideo.c: In function 'init_rl':
mpegvideo.c:760: warning: pointer targets in assignment differ in
signedness
mpegvideo.c:765: warning: pointer targets in assignment differ in
signedness
In file included from mpegvideo.c:34:
mpegvideo_common.h: In function 'MPV_motion':
mpegvideo_common.h:674: warning: dereferencing pointer '({anonymous})'
does brea
k strict-aliasing rules
mpegvideo_common.h:674: note: initialized from here
mpegvideo_common.h:675: warning: dereferencing pointer '({anonymous})'
does brea
k strict-aliasing rules
mpegvideo_common.h:675: note: initialized from here
mpegvideo_common.h:677: warning: dereferencing pointer '({anonymous})'
does brea
k strict-aliasing rules
mpegvideo_common.h:677: note: initialized from here
mpegvideo_common.h:678: warning: dereferencing pointer '({anonymous})'
does brea
k strict-aliasing rules
mpegvideo_common.h:678: note: initialized from here

here is snippet of .i file.full file have size 2476 kb.please let me know if you need more info or send me fixes, i can compile new gcc

# 1594 "mpegvideo.c"
static inline void MPV_motion_lowres(MpegEncContext *s,
                              uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
                              int dir, uint8_t **ref_picture,
                              h264_chroma_mc_func *pix_op)
{
    int mx, my;
    int mb_x, mb_y, i;
    const int lowres= s->avctx->lowres;
    const int block_s= 8>>lowres;

    mb_x = s->mb_x;
    mb_y = s->mb_y;

    switch(s->mv_type) {
    case 0:
        mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                    0, 0, 0,
                    ref_picture, pix_op,
                    s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s);
        break;
    case 1:
        mx = 0;
        my = 0;
            for(i=0;i<4;i++) {
                hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * s->linesize)*block_s,
                            ref_picture[0], 0, 0,
                            (2*mb_x + (i & 1))*block_s, (2*mb_y + (i >>1))*block_s,
                            s->width, s->height, s->linesize,
                            s->h_edge_pos >> lowres, s->v_edge_pos >> lowres,
                            block_s, block_s, pix_op,
                            s->mv[dir][i][0], s->mv[dir][i][1]);

                mx += s->mv[dir][i][0];
                my += s->mv[dir][i][1];
            }

        if(!0 || !(s->flags&0x2000))
            chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my);
        break;
    case 3:
        if (s->picture_structure == 3) {

            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                        1, 0, s->field_select[dir][0],
                        ref_picture, pix_op,
                        s->mv[dir][0][0], s->mv[dir][0][1], block_s);

            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                        1, 1, s->field_select[dir][1],
                        ref_picture, pix_op,
                        s->mv[dir][1][0], s->mv[dir][1][1], block_s);
        } else {
            if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != 3 && !s->first_field){
                ref_picture= s->current_picture_ptr->data;
            }

            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                        0, 0, s->field_select[dir][0],
                        ref_picture, pix_op,
                        s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s);
        }
        break;
    case 2:
        for(i=0; i<2; i++){
            uint8_t ** ref2picture;

            if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == 3 || s->first_field){
                ref2picture= ref_picture;
            }else{
                ref2picture= s->current_picture_ptr->data;
            }

            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                        0, 0, s->field_select[dir][i],
                        ref2picture, pix_op,
                        s->mv[dir][i][0], s->mv[dir][i][1] + 2*block_s*i, block_s);

            dest_y += 2*block_s*s->linesize;
            dest_cb+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
            dest_cr+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
        }
        break;
    case 4:
        if(s->picture_structure == 3){
            for(i=0; i<2; i++){
                int j;
                for(j=0; j<2; j++){
                    mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                                1, j, j^i,
                                ref_picture, pix_op,
                                s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], block_s);
                }
                pix_op = s->dsp.avg_h264_chroma_pixels_tab;
            }
        }else{
            for(i=0; i<2; i++){
                mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                            0, 0, s->picture_structure != i+1,
                            ref_picture, pix_op,
                            s->mv[dir][2*i][0],s->mv[dir][2*i][1],2*block_s);


                pix_op = s->dsp.avg_h264_chroma_pixels_tab;


                if(!s->first_field){
                    ref_picture = s->current_picture_ptr->data;
                }
            }
        }
    break;
    default: ((void) 0);
    }
}


static inline void put_dct(MpegEncContext *s,
                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
{
    s->dct_unquantize_intra(s, block, i, qscale);
    s->dsp.idct_put (dest, line_size, block);
}


static inline void add_dct(MpegEncContext *s,
                           DCTELEM *block, int i, uint8_t *dest, int line_size)
{
    if (s->block_last_index[i] >= 0) {
        s->dsp.idct_add (dest, line_size, block);
    }
}

static inline void add_dequant_dct(MpegEncContext *s,
                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
{
    if (s->block_last_index[i] >= 0) {
        s->dct_unquantize_inter(s, block, i, qscale);

        s->dsp.idct_add (dest, line_size, block);
    }
}




void ff_clean_intra_table_entries(MpegEncContext *s)
{
    int wrap = s->b8_stride;
    int xy = s->block_index[0];

    s->dc_val[0][xy ] =
    s->dc_val[0][xy + 1 ] =
    s->dc_val[0][xy + wrap] =
    s->dc_val[0][xy + 1 + wrap] = 1024;

    memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t));
    memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t));
    if (s->msmpeg4_version>=3) {
        s->coded_block[xy ] =
        s->coded_block[xy + 1 ] =
        s->coded_block[xy + wrap] =
        s->coded_block[xy + 1 + wrap] = 0;
    }

    wrap = s->mb_stride;
    xy = s->mb_x + s->mb_y * wrap;
    s->dc_val[1][xy] =
    s->dc_val[2][xy] = 1024;

    memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
    memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));

    s->mbintra_table[xy]= 0;
}
# 1779 "mpegvideo.c"
static __attribute__((always_inline)) inline
void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
                            int lowres_flag, int is_mpeg12)
{
    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
    if(0 && s->avctx->xvmc_acceleration){
        ff_xvmc_decode_mb(s);
        return;
    }

    if(s->avctx->debug&0x00000040) {

       int i,j;
       DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6];
       for(i=0; i<6; i++)
           for(j=0; j<64; j++)
               *dct++ = block[i][s->dsp.idct_permutation[j]];
    }

    s->current_picture.qscale_table[mb_xy]= s->qscale;


    if (!s->mb_intra) {
        if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) {
            if(s->mbintra_table[mb_xy])
                ff_clean_intra_table_entries(s);
        } else {
            s->last_dc[0] =
            s->last_dc[1] =
            s->last_dc[2] = 128 << s->intra_dc_precision;
        }
    }
    else if (!is_mpeg12 && (s->h263_pred || s->h263_aic))
        s->mbintra_table[mb_xy]=1;

    if ((s->flags&0x8000) || !(s->encoding && (s->intra_only || s->pict_type==3) && s->avctx->mb_decision != 2)) {
        uint8_t *dest_y, *dest_cb, *dest_cr;
        int dct_linesize, dct_offset;
        op_pixels_func (*op_pix)[4];
        qpel_mc_func (*op_qpix)[16];
        const int linesize= s->current_picture.linesize[0];
        const int uvlinesize= s->current_picture.linesize[1];
        const int readable= s->pict_type != 3 || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
        const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;



        if(!s->encoding){
            uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
            const int age= s->current_picture.age;

            ((void) 0);

            if (s->mb_skipped) {
                s->mb_skipped= 0;
                ((void) 0);

                (*mbskip_ptr) ++;
                if(*mbskip_ptr >99) *mbskip_ptr= 99;


                if (*mbskip_ptr >= age && s->current_picture.reference){
                    return;
                }
            } else if(!s->current_picture.reference){
                (*mbskip_ptr) ++;
                if(*mbskip_ptr >99) *mbskip_ptr= 99;
            } else{
                *mbskip_ptr = 0;
            }
        }

        dct_linesize = linesize << s->interlaced_dct;
        dct_offset =(s->interlaced_dct)? linesize : linesize*block_size;

        if(readable){
            dest_y= s->dest[0];
            dest_cb= s->dest[1];
            dest_cr= s->dest[2];
        }else{
            dest_y = s->b_scratchpad;
            dest_cb= s->b_scratchpad+16*linesize;
            dest_cr= s->b_scratchpad+32*linesize;
        }

        if (!s->mb_intra) {


            if(!s->encoding){
                if(lowres_flag){
                    h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;

                    if (s->mv_dir & 1) {
                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix);
                        op_pix = s->dsp.avg_h264_chroma_pixels_tab;
                    }
                    if (s->mv_dir & 2) {
                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix);
                    }
                }else{
                    op_qpix= s->me.qpel_put;
                    if ((!s->no_rounding) || s->pict_type==3){
                        op_pix = s->dsp.put_pixels_tab;
                    }else{
                        op_pix = s->dsp.put_no_rnd_pixels_tab;
                    }
                    if (s->mv_dir & 1) {
                        MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
                        op_pix = s->dsp.avg_pixels_tab;
                        op_qpix= s->me.qpel_avg;
                    }
                    if (s->mv_dir & 2) {
                        MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
                    }
                }
            }


            if(s->hurry_up>1) goto skip_idct;
            if(s->avctx->skip_idct){
                if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == 3)
                   ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != 1)
                   || s->avctx->skip_idct >= AVDISCARD_ALL)
                    goto skip_idct;
            }


            if(s->encoding || !( s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
                                || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){
                add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale);
                add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale);
                add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);

                if(!0 || !(s->flags&0x2000)){
                    if (s->chroma_y_shift){
                        add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
                        add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
                    }else{
                        dct_linesize >>= 1;
                        dct_offset >>=1;
                        add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale);
                        add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale);
                        add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
                        add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
                    }
                }
            } else if(is_mpeg12 || (s->codec_id != CODEC_ID_WMV2)){
                add_dct(s, block[0], 0, dest_y , dct_linesize);
                add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
                add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
                add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);

                if(!0 || !(s->flags&0x2000)){
                    if(s->chroma_y_shift){
                        add_dct(s, block[4], 4, dest_cb, uvlinesize);
                        add_dct(s, block[5], 5, dest_cr, uvlinesize);
                    }else{

                        dct_linesize = uvlinesize << s->interlaced_dct;
                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;

                        add_dct(s, block[4], 4, dest_cb, dct_linesize);
                        add_dct(s, block[5], 5, dest_cr, dct_linesize);
                        add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
                        add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
                        if(!s->chroma_x_shift){
                            add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
                            add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
                            add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
                            add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
                        }
                    }
                }
            }
            else if ((1 || 1)) {
                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
            }
        } else {

            if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){
                put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale);
                put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale);
                put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);

                if(!0 || !(s->flags&0x2000)){
                    if(s->chroma_y_shift){
                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
                    }else{
                        dct_offset >>=1;
                        dct_linesize >>=1;
                        put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale);
                        put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale);
                        put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
                        put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
                    }
                }
            }else{
                s->dsp.idct_put(dest_y , dct_linesize, block[0]);
                s->dsp.idct_put(dest_y + block_size, dct_linesize, block[1]);
                s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]);
                s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);

                if(!0 || !(s->flags&0x2000)){
                    if(s->chroma_y_shift){
                        s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
                        s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
                    }else{

                        dct_linesize = uvlinesize << s->interlaced_dct;
                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;

                        s->dsp.idct_put(dest_cb, dct_linesize, block[4]);
                        s->dsp.idct_put(dest_cr, dct_linesize, block[5]);
                        s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
                        s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
                        if(!s->chroma_x_shift){
                            s->dsp.idct_put(dest_cb + 8, dct_linesize, block[8]);
                            s->dsp.idct_put(dest_cr + 8, dct_linesize, block[9]);
                            s->dsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
                            s->dsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
                        }
                    }
                }
            }
        }
skip_idct:
        if(!readable){
            s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16);
            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);
            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift);
        }
    }
}
Comment 1 Andreas Schwab 2009-06-11 13:52:26 UTC
*** Bug 40415 has been marked as a duplicate of this bug. ***
Comment 2 Paolo Bonzini 2009-06-11 15:03:33 UTC
Could be a duplicate of one of PR30064, PR34439, PR37053.
Comment 3 gni 2009-06-15 19:36:25 UTC
Subject:  gcc 4.4.0 error at postreload.c:396

(In reply to comment #2)
> Could be a duplicate of one of PR30064, PR34439, PR37053.

I compiled the provided testcases as stated in the appropriate PR
with the following result:

The testcase for PR30064 does ICE with 3.4.6 and 4.[012].0, it doesn't
ICE with 4.[34].0.

The testcase for PR34439 does ICE with 3.4.6 when not optimizing, does
always ICE with 4.[012].0. No ICE with 4.[34].0.

The testcase for PR37053 does ICE with 2.95.x without optimization,
3.[34].6 and 4.[012].0 always ICE, 4.[34].0 does ICE with optimization.

Comment 4 bernd_afa 2009-06-16 11:06:28 UTC
i get report of more info about -funswitch-loops

The -funswitch-loops Option seem work on gcc 4.3.0 and above not good for speed.It generate much larger code(wma123) and code is slower in many case (try out ffmpeg H264 decode)i get report from a Athlon 2600+ with single channel ram running amiga emulator.

But on my System use a AMD64 3000+ and Dual Channel ram running amiga emulator -funswitch-loops cause only large files but no slowdown.

but i guess on a real 68k CPU without 2. level cache, -funswitch-loops is more not optimal.
gcc 3.4.0 have too this option set on -O3 or i am wrong ?
and here the speed is better.

Is there a way to tweak some values on backend for specific CPU so -funswitch-loops works 3.4.0(maybe unroll not so much loops ?

for now best solution for speed (H264 decode work on the system with single Channel ram same ot little faster as 3.4.0 build.) is let disable -funswitch-loops disable as far i get speedvalue reports. 

here are some values that show too slowdown on compilers 4.2.4 and 4.3.0 but on X86

http://multimedia.cx/eggs/compiler-performance-profiling-with-ffmpeg/

The GCC 4.4.0 does allow change the compiler switches in sourceline.

maybe somebody can tell if can get more precise information with that feature, what codeline cause the fault.

the furtherdevelop of Blitz basic (called amiblitz)can for example can set optimize on every sourceline.this help lot to find sourceline that make problem in peephole optimizer.

But Amiblitz of course have not such a longlooking ahead peephole optimizer as gcc.
but maybe this gcc 4.4.0 feature can help in any way,to get more precise error place ?

I can then test and report more.
Comment 5 bernd_afa 2009-08-02 07:23:35 UTC
the problem happen on a gcc4.4.1 (the release) too,this is output.

$ make_68k_v4
/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.1.exe -V 4.4.1 -DHAVE_AV_CONFIG_H -I.
-I"/bin/ffmpeg8" -mnobitfield -m68060 -std=c99  -Wdeclaration-after-stat
ement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE
=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-poin
ter -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-stri
ngs -Wundef -O3 -s          -c -o libavcodec/mpegvideo.o libavcodec/mpegvideo.c
libavcodec/mpegvideo.c: In function 'init_rl':
libavcodec/mpegvideo.c:760: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c:765: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c: In function 'MPV_motion_lowres':
libavcodec/mpegvideo.c:1707: error: insn does not satisfy its constraints:
(insn 937 3765 3766 59 libavcodec/mpegvideo.c:1488 (set (reg:SI 0 d0 [931])
        (plus:SI (mem/f:SI (reg:SI 9 a1) [7 S4 A16])
            (reg:SI 0 d0 [931]))) 131 {*addsi3_internal} (nil))
libavcodec/mpegvideo.c:1707: internal compiler error: in reload_cse_simplify_ope
rands, at postreload.c:396
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 6 bernd_afa 2009-08-06 15:56:15 UTC
I check now more to find the instruction line that cause the ICE.Its this call.It compile when i remove in 1 statement the 2 
(2*mb_x + (i & 1))*block_s  -> (mb_x + (i & 1))*block_s 

But of course the program work.

it also compile when i let the 2 in first par in but remove it on second.

    case 1:
        mx = 0;
        my = 0;
            for(i=0;i<4;i++) {
                hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) *
s->linesize)*block_s,
                            ref_picture[0], 0, 0,
                            (2*mb_x + (i & 1))*block_s, (2*mb_y + (i
>>1))*block_s,
                            s->width, s->height, s->linesize,
                            s->h_edge_pos >> lowres, s->v_edge_pos >> lowres,
                            block_s, block_s, pix_op,
                            s->mv[dir][i][0], s->mv[dir][i][1]);

                mx += s->mv[dir][i][0];
                my += s->mv[dir][i][1];
            }
Comment 7 ami_stuff 2009-08-17 19:25:24 UTC
The problem is not with "-funswitch-loops" optimization.

I get no ICE with these options (-O2 -fipa-cp-clone -finline-functions -fgcse-after-reload -ftree-vectorize -fpredictive-commoning):

OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -Wundef -O2 -fipa-cp-clone -finline-functions -fgcse-after-reload -ftree-vectorize -fpredictive-commoning

I get ICE with -O3:

OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -Wundef -O3

Also, ICE happens ONLY with -m68060 flag! When I use "-m68020 -m6881" or -m68040 there is no ICE!
Comment 8 ami_stuff 2009-08-17 19:33:42 UTC
(In reply to comment #7)
> The problem is not with "-funswitch-loops" optimization.
> 
> I get no ICE with these options (-O2 -fipa-cp-clone -finline-functions
> -fgcse-after-reload -ftree-vectorize -fpredictive-commoning):
> 
> OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement
> -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE
> -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common
> -fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls
> -Wcast-qual -Wwrite-strings -Wundef -O2 -fipa-cp-clone -finline-functions
> -fgcse-after-reload -ftree-vectorize -fpredictive-commoning
> 
> I get ICE with -O3:
> 
> OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement
> -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE
> -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common
> -fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls
> -Wcast-qual -Wwrite-strings -Wundef -O3
> 
> Also, ICE happens ONLY with -m68060 flag! When I use "-m68020 -m6881" or
> -m68040 there is no ICE!
> 

Sorry, I forgot to add "-funswitch-loops" option, so again:

The problem is not with "-funswitch-loops" optimization.

I get no ICE with these options (-O2 -fipa-cp-clone -finline-functions
-fgcse-after-reload -ftree-vectorize -fpredictive-commoning -funswitch-loops):

OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -Wundef -O2 -fipa-cp-clone -finline-functions -fgcse-after-reload -ftree-vectorize -fpredictive-commoning -funswitch-loops

I get ICE with -O3:

OPTFLAGS= -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement
-Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE
-D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common
-fomit-frame-pointer -Wall -Wno-switch -Wpointer-arith -Wredundant-decls
-Wcast-qual -Wwrite-strings -Wundef -O3

Also, ICE happens ONLY with -m68060 flag! When I use "-m68020 -m6881" or
-m68040 there is no ICE!
Comment 9 ami_stuff 2009-08-17 20:11:00 UTC
Created attachment 18390 [details]
preprocessed file -O3
Comment 10 ami_stuff 2009-08-17 20:11:50 UTC
Created attachment 18391 [details]
asm output -O3
Comment 11 ami_stuff 2009-08-19 00:28:42 UTC
It ICEs also...

with -m68020 -m68881 -Os options:

/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.1.exe -V 4.4.1 -DHAVE_AV_CONFIG_H -I.
-I"/bin/ffmpeg8" -mnobitfield -m68020 -m68881 -std=c99  -Wdeclaration-after-stat
ement -Wdisabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE
=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-poin
ter -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-stri
ngs -Wundef -Os          -c -o libavcodec/mpegvideo.o libavcodec/mpegvideo.c
libavcodec/mpegvideo.c: In function 'init_rl':
libavcodec/mpegvideo.c:760: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c:765: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c: In function 'MPV_motion_lowres':
libavcodec/mpegvideo.c:1707: error: insn does not satisfy its constraints:
(insn 647 2733 2734 49 libavcodec/mpegvideo.c:1488 (set (reg/v/f:SI 7 d7 [orig:2
93 ptr_y ] [293])
        (plus:SI (mem/f:SI (reg:SI 8 a0) [7 S4 A16])
            (reg:SI 7 d7 [637]))) 131 {*addsi3_internal} (nil))
libavcodec/mpegvideo.c:1707: internal compiler error: in reload_cse_simplify_ope
rands, at postreload.c:396
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


with -m68040 -Os options:

/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.1.exe -V 4.4.1 -DHAVE_AV_CONFIG_H -I.
-I"/bin/ffmpeg8" -mnobitfield -m68040 -std=c99  -Wdeclaration-after-statement -W
disabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-pointer -Wal
l -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -Wun
def -Os          -c -o libavcodec/mpegvideo.o libavcodec/mpegvideo.c
libavcodec/mpegvideo.c: In function 'init_rl':
libavcodec/mpegvideo.c:760: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c:765: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c: In function 'MPV_motion_lowres':
libavcodec/mpegvideo.c:1707: error: insn does not satisfy its constraints:
(insn 647 2733 2734 49 libavcodec/mpegvideo.c:1488 (set (reg/v/f:SI 7 d7 [orig:2
93 ptr_y ] [293])
        (plus:SI (mem/f:SI (reg:SI 8 a0) [7 S4 A16])
            (reg:SI 7 d7 [637]))) 131 {*addsi3_internal} (nil))
libavcodec/mpegvideo.c:1707: internal compiler error: in reload_cse_simplify_ope
rands, at postreload.c:396
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


with -m68060 -Os options:

/usr/local/amiga/bin/m68k-amigaos-gcc-4.4.1.exe -V 4.4.1 -DHAVE_AV_CONFIG_H -I.
-I"/bin/ffmpeg8" -mnobitfield -m68060 -std=c99  -Wdeclaration-after-statement -W
disabled-optimization -fno-math-errno -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -fomit-frame-pointer -Wal
l -Wno-switch -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -Wun
def -Os          -c -o libavcodec/mpegvideo.o libavcodec/mpegvideo.c
libavcodec/mpegvideo.c: In function 'init_rl':
libavcodec/mpegvideo.c:760: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c:765: warning: pointer targets in assignment differ in sig
nedness
libavcodec/mpegvideo.c: In function 'MPV_motion_lowres':
libavcodec/mpegvideo.c:1707: error: insn does not satisfy its constraints:
(insn 637 2688 2689 49 libavcodec/mpegvideo.c:1488 (set (reg/v/f:SI 7 d7 [orig:2
89 ptr_y ] [289])
Comment 12 Mikael Pettersson 2009-08-19 10:38:24 UTC
ICE confirmed with a gcc-4.4.1 cross to m68k-linux. Applying the PR37053 and PR41064 fixes eliminated the ICE.

The mpegvideo.i test case does not compile as-is for me, as the compiler complains about a syntax error:

libavcodec/mpegvideo.c:89: error: expected ';', ',' or ')' before 'p'

That's the ff_find_start_code() function head. Commenting out the restrict key words eliminated that problem, leaving only the ICE to deal with.
Comment 13 Andreas Schwab 2009-08-23 18:25:07 UTC
Fixed in 4.5.0.
Comment 14 bernd_afa 2009-08-27 10:38:47 UTC
I compile gcc 4.4.2 20090825 and test.

problem is still in.

Is this fix in gcc4.4.2 too ?.

>The mpegvideo.i test case does not compile as-is for me, as the compiler
>complains about a syntax error:
>libavcodec/mpegvideo.c:89: error: expected ';', ',' or ')' before 'p'

because ffmpeg use cpu specific code, you must configure first for crosscompile.This line is used for the 68k compilers run on cygwin.

./configure --arch=m68k --enable-cross-compile --cross-prefix=m68k-amigaos- --extra-cflags="-mnobitfield -m68060"

Comment 15 Mikael Pettersson 2009-09-03 18:58:11 UTC
(In reply to comment #14)
> I compile gcc 4.4.2 20090825 and test.
> 
> problem is still in.
> 
> Is this fix in gcc4.4.2 too ?.

No, so far these fixes have only been applied to trunk aka gcc-4.5. They are easily backported to 4.4 and 4.3 however (I've done that for my 4.4/4.3 trees).
Comment 16 Andreas Schwab 2009-12-29 16:31:07 UTC
m68k-amigaos is not a supported target.
Comment 17 ami_stuff 2009-12-29 17:29:45 UTC
> m68k-amigaos is not a supported target.

LOL! So you prefere to not get any bugreports? I reported a few bugs which were next confirmed on the other hardware and after some time fixed, no matter if I use unsupported m68-amigaos target or not. I think that there is no chance to see any m68k-specific bugs fixed, so I will not waste my time in the future.

Please don't forget to close the rest of my bugreports, because I also used m68k-amigaos unsupported target. You may also chage status from FIXED to INVALID if you prefere...
Comment 18 Paolo Bonzini 2009-12-29 18:01:14 UTC
True, it is P5 but it is not invalid.  Andreas, if you want to close this as invalid you should first follow the target deprecation process and propose to remove the target for 4.6.
Comment 19 bernd_afa 2009-12-29 18:44:50 UTC
The Problem is fixed in GCC4.5.0.

Comment 20 Paolo Bonzini 2009-12-29 19:30:43 UTC
Adding dependencies on the patches that fix the bug.
Comment 21 joseph@codesourcery.com 2009-12-29 21:44:20 UTC
Subject: Re:  gcc 4.4.0 error at postreload.c:396

On Tue, 29 Dec 2009, bonzini at gnu dot org wrote:

> True, it is P5 but it is not invalid.  Andreas, if you want to close this as
> invalid you should first follow the target deprecation process and propose to
> remove the target for 4.6.

It is not a question of deprecation.  There is no m68k-amigaos support in 
FSF GCC and I don't think there ever has been.  Thus the submitter is 
using a version of GCC with an unknown set of third-party modifications.  
They should report any bugs to the provider of that modified version of 
GCC.  That provider should determine whether the bugs are present in 
unmodified FSF GCC for some m68k-* target supported by FSF GCC, and pass 
on the reports to GCC Bugzilla (referencing the target supported by FSF 
GCC) if so.  The bug reporting instructions are quite explicit that bugs 
in non-FSF versions of GCC do nto go here.

Comment 22 bernd_afa 2009-12-30 09:39:58 UTC
>There is no m68k-amigaos support in 
>FSF GCC and I don't think there ever has been.

There is support for m68k-amigaos in FSF GCC.

search in gcc source for name amigaos and on changelog.lib you find this

Wed Sep 10 15:14:20 1997  Jeffrey A Law  (law@cygnus.com)

	* config.sub: Use "amigaos" instread of "amigados".  Still
	recognize "amigados" for backward compatibility. 

Sun Sep  7 23:18:32 1997  Fred Fish  <fnf@ninemoons.com>

	* INSTALL: Change 'amigados' to 'amigaos' to match current usage.
	* install.texi (Configurations): Likewise.
	* config.sub: Likewise. 

In file configure you find more.

Now seem m68k-amigaos should remove, where is decicde if a target is remove or not ?

---------------

But its true that amigaos cant build without changes from FSF GCC configfiles.But there are no C or C++ source changes need. 

I fear to submit the changes, not that m68k-amigaos get remove, because the amiga OS change offical to PPC CPU since 7 years, but the PPC amigaos is not on FSF GCC and they have only old compilers 

m68k-amigaos is still used today and new programs are written with GCC 4.5.0 and there are users that use it

See here the uploads of the last 14 days.The yellow Symbol is m68k-amigaos

http://aminet.net/

To get m68k-amigaos compile is very easy, so i compile actual compiler and when a problem occur we try to find it near and report it.We verify very carefully, because we know a wrong bugreport increase the risc that m68k-amigaos os maybe remove.

To get amigaos compile i have a small readme text file, that explain the steps what lines must add to the configure files of Gcc and the platform specific files that need copy and work always because of the GGC backend API

add in gcc-x.x.x/gcc/config.gcc

(search for m68k)

m68k-*-amigaos*)
	tmake_file=m68k/t-amigaos
	tm_file="${tm_file} m68k/amigaos.h"
	tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
	tm_defines="TARGET_AMIGAOS TARGET_DEFAULT=0" # 68040
	extra_objs=amigaos.o
	gnu_ld=yes
	;;


in gcc-x.x.x/gcc/config/m68k dir add files (from the 4.3.2 source)

amigaos.h      
amigaos.c      
t-amigaos       
x-amigaos       
xm-amigaos.h 
amigaos-protos.h
host-amigaos.c

in dir gcc-x.x.x//gcc add file
amigacollect2.c

thats enough to build the gcc.more steps are need, to build the libs, libgcc libstdc++ when you want new

to build libgcc: add in libgcc/config.host 68k cpu and later amigaos.see file from 4.3.2 or use same.


the dir amigaos must add in libstdc++-v3/config (see 4.3.2 source)
now you can compile all. 

when you get assembler error in atomicity.h change line with the cas so that, the \n is last char.
 "cas.l %0 , %1 , %2 \n"

for build libstdc++ with the crosscompilers you need do this steps too

in libstdc++/configure

after (search for "GLIBCXX_IS_NATIVE=true")

""""
if test $hostos = $targetos -o $targetos = darwin ; then
	  GLIBCXX_IS_NATIVE=true
	fi
	;;
""""
add this lines

"""
*-*-amigaos*)
     LDFLAGS="${LDFLAGS-ld} -noixemul"
     ;;
""""
search for "Base decisions on target environment"

"""" 
# Base decisions on target environment.
 case "${host}" in
""""
add this lines
"""
  m68k-*-amigaos*)
    #os_include_dir="usr/local/amiga/m68k-amigaos/include"
    ;;
"""
in gccx.x.x/libiberty/configure 

after this lines

""""
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

_ACEOF
fi
""""
add this line

LDFLAGS="${LDFLAGS-ld} -noixemul"

Comment 23 Paolo Bonzini 2009-12-30 10:56:01 UTC
You need a proper patch, not instructions.

However, it's clear from the bugreport and the patches required to fix it, that it is not important whether the target is m68k-amigaos or another OS.
Comment 24 bernd_afa 2009-12-30 12:06:57 UTC
(In reply to comment #23)
> You need a proper patch, not instructions.
> 
> However, it's clear from the bugreport and the patches required to fix it, that
> it is not important whether the target is m68k-amigaos or another OS.
> 

Yes i know, and i can do a diff, but are there chances that this changes are add or is m68k-amigaos going to remove complete in 4.6 ?

Wy can not the code stay in as long it work well ?

m68k-amigaos is a m68k bsd a.out Build that use sjlj Exception Handling on C++.
So there is no special support Code for AOS need and it work well with newest compilers.

The only that need add to compile GCC and g++ is this.

add in gcc-x.x.x/gcc/config.gcc

(search for m68k)

m68k-*-amigaos*)
        tmake_file=m68k/t-amigaos
        tm_file="${tm_file} m68k/amigaos.h"
        tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
        tm_defines="TARGET_AMIGAOS TARGET_DEFAULT=0" # 68040
        extra_objs=amigaos.o
        gnu_ld=yes
        ;;

more add in config files is only need for libgcc and libstdc++

When report a Bug, we can also compare the asm Code with a better support 68k Target, thats no Problem, but we thought because of same C Code all work same.

But i like know what 68k target Andreas or other GCC Developer for 68k use and what configure Options they use so i can build a cygwin Version for this compilers.

Or is there a binary build for cygwin and these 68k Compilers here ? 
Comment 25 Paolo Bonzini 2009-12-30 12:22:29 UTC
Adding target support without at least libgcc makes little sense.

The small part in config.guess/config.sub is not going to be removed, since those files are just imported in GCC and are handled as a separate project.

People use m68k-elf or m68k-uclinux to build cross compilers.  The former can be built easily using a combined tree.
Comment 26 Richard Biener 2010-04-06 11:20:15 UTC
GCC 4.5.0 is being released.  Deferring to 4.5.1.
Comment 27 Richard Biener 2010-07-31 09:29:28 UTC
GCC 4.5.1 is being released, adjusting target milestone.
Comment 28 Paolo Bonzini 2010-11-01 16:40:07 UTC
Same ICE, marking as duplicate.

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