While cross-compiling sqlite3.2.1, my Blackfin C compiler gives the 
following warning:

".\src\pager.c", line 1342: cc0111: {D} warning: statement is unreachable
    assert( rc==SQLITE_OK );

The context is:

<begin code snippet>
  /* This loop terminates either when the readJournalHdr() call returns
  ** SQLITE_DONE or an IO error occurs. */
  while( 1 ){

    // CODE OMITTED WITH NO break;

    /* rc = sqlite3OsSeek(&pPager->jfd, JOURNAL_HDR_SZ(pPager)); */
    if( rc!=SQLITE_OK ) goto end_playback;
 
    /* Copy original pages out of the journal and back into the database 
file.
    */
    for(i=0; i<nRec; i++){
      rc = pager_playback_one_page(pPager, &pPager->jfd, 1);
      if( rc!=SQLITE_OK ){
        if( rc==SQLITE_DONE ){
          rc = SQLITE_OK;
          pPager->journalOff = szJ;
          break;
        }else{
          goto end_playback;
        }
      }
    }
  }

  /* Pages that have been written to the journal but never synced
  ** where not restored by the loop above.  We have to restore those
  ** pages by reading them back from the original database.
  */
  assert( rc==SQLITE_OK );
  pager_reload_cache(pPager);

end_playback: 
<end code snippet>

I think the compiler is right. I am not familiar with the sqlite3 source 
code, but the break at line 1330 breaks the for() loop at line 1324, NOT 
the while() loop at line 1281.  Is that as it is intended, or is it a 
potential bug?

Best regards,
Frank.

Reply via email to