SQLite

Check-in [40c44d38]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Turns out this is an aliasing bug in SQLite, not a GCC bug. Was: Work-around for what appears to be another GCC bug - this one for GCC 8.3.0 on ARM. See the SQLite forum post for discussion.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA3-256: 40c44d38104dfcb688155d1172cb172c1bb1d90d54ecf0cfd89f0810c1b515d9
User & Date: drh 2020-07-23 20:37:39
Original Comment: Work-around for what appears to be another GCC bug - this one for GCC 8.3.0 on ARM. See the SQLite forum post for discussion.
Context
2020-07-23
20:37
Turns out this is an aliasing bug in SQLite, not a GCC bug. Was: Work-around for what appears to be another GCC bug - this one for GCC 8.3.0 on ARM. See the SQLite forum post for discussion. (Closed-Leaf check-in: 40c44d38 user: drh tags: mistake)
18:03
Add the OMIT_ZLIB compile-time option to sessionfuzz.c. (Originally checked into the wrong branch.) (check-in: 6019bf8a user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/memjournal.c.

372
373
374
375
376
377
378


















379
380
381

382
383
384
385
386
387
388
  p->zJournal = zName;
  p->pVfs = pVfs;
  return SQLITE_OK;
}

/*
** Open an in-memory journal file.


















*/
void sqlite3MemJournalOpen(sqlite3_file *pJfd){
  sqlite3JournalOpen(0, 0, pJfd, 0, -1);

}

#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
 || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
/*
** If the argument p points to a MemJournal structure that is not an 
** in-memory-only journal file (i.e. is one that was opened with a +ve







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|

>







372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  p->zJournal = zName;
  p->pVfs = pVfs;
  return SQLITE_OK;
}

/*
** Open an in-memory journal file.
**
** The SQLITE_NOINLINE is to work-around for what appears to be a bug in GCC
** (version 8.3.0 tested) for ARM.  The GCC optimizer apparently believes
** that the call to this routine from pager_open_journal() cannot change
** the value of pJfd->pMethods.  Hence it caches the prior NULL value of
** pJfd->pMethods and reuses that NULL it inside a subsequent assert(),
** which then fails.  See
**
**    https://bugs.gentoo.org/685874
**    https://bugs.gentoo.org/733092
**    https://sqlite.org/forum/forumpost/d44eb2fc44
**
** The problem only appears for -O2.  -O1, -Os, and -O0 all work fine.  The
** Gentoo bugs above indicate that a similar problem exists on PPC and SPARC,
** but I have only verify the problem (and this fix) on ARM.
**
** This routine is not often called, so preventing it from being
** inlined does not impact performance.
*/
SQLITE_NOINLINE void sqlite3MemJournalOpen(sqlite3_file *pJfd){
  sqlite3JournalOpen(0, 0, pJfd, 0, -1);
  assert( pJfd->pMethods!=0 );
}

#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
 || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
/*
** If the argument p points to a MemJournal structure that is not an 
** in-memory-only journal file (i.e. is one that was opened with a +ve