[llvm-bugs] [Bug 29034] New: [gvn-hoist] miscompile

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 18 03:45:13 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=29034

            Bug ID: 29034
           Summary: [gvn-hoist] miscompile
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: zyfwong at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16981
  --> https://llvm.org/bugs/attachment.cgi?id=16981&action=edit
before opt -gvn-hoist

gvn-hoist seems to hoist a store before load:

the c code is something like:
void music_task(void *p)
{
    MUSIC_OP_API *mapi=((void*)0);
    dec_inf_t *dec_info=((void*)0);
    u32 err;
    tbool file_auto_next = 1;

    music_decoder_init(&mapi);

    while(1)
    {
        err =
music_play_api(mapi,DEV_SEL_CUR,0,PLAY_SPEC_FILE,&(mapi->dop_api->file_num));
        while(0 != err)
        {
            u32 status;
            switch(err)
            {
            case SUCC_MUSIC_START_DEC:
                err = 0;
                printf("s_num:%d\n",mapi->dop_api->file_num); /// <-------
after -gvn-hoist,   mapi->do_api->file_num will always be 1
                break;
            case FILE_OP_ERR_END_FILE:
                mapi->dop_api->file_num = 1;
                err =
music_play_api(mapi,DEV_SEL_NEXT,0,PLAY_FIRST_FILE,&(mapi->dop_api->file_num));
                break;
            case FILE_OP_ERR_PRE_FILE:
                mapi->dop_api->file_num = 1;
                err =
music_play_api(mapi,DEV_SEL_PREV,0,PLAY_LAST_FILE,&(mapi->dop_api->file_num));
                break;
            default:
                err = music_play_api(mapi,DEV_SEL_CUR,0,PLAY_NEXT_FILE,0);
                break;
            }
        }
    }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160818/a154f18f/attachment.html>


More information about the llvm-bugs mailing list