Bug #92134 Remove workaround for GCC bug 77673 for newer GCC versions
Submitted: 22 Aug 2018 18:06 Modified: 30 Sep 2018 7:31
Reporter: Alexey Kopytov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5, 5.6, 5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any

[22 Aug 2018 18:06] Alexey Kopytov
Description:
The fix for bug #83073 introduced a workaround for GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673, which has been fixed
by now in all affected GCC branches.

The GCC bug report says the problem is not reproducible with GCC 5.4.1,
6.2.1 and 7.0. However, the workaround in InnoDB code is enabled for any
GCC version 5 or higher.

From storage/innobase/mach/mach0data.cc:mach_parse_compressed():

---
  /* Workaround GCC bug
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673:
    the compiler moves mach_read_from_4 right to the beginning of the
    function, causing and out-of-bounds read if we are reading a short
    integer close to the end of buffer. */
#if defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__clang__)
#define DEPLOY_FENCE
#endif

#ifdef DEPLOY_FENCE
  __atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
---

I guess the check for affected compilers could be more specific.

How to repeat:
Code analysis.
[22 Aug 2018 18:34] MySQL Verification Team
Thank you for the bug report.
[23 Aug 2018 8:14] Laurynas Biveinis
Duplicate of bug 89427
[30 Sep 2018 7:31] Erlend Dahl
Duplicate of 

Bug#89427 Cap workaround for GCC bug 77673