Back in February, I attended the WG21 C++ standards committee meeting in rainy Kona, Hawaii (yes, it rained most of the week). This report is so late that we’re now preparing for the next meeting, which will take place mid-July in Cologne.
As usual, I spent the majority of my time in the Library Working Group (for LWG; for details on the various Working Groups and Study Groups see Standard C++: The Committee). The purpose of the LWG is to formalize the specification of the C++ Standard Library, i.e. the second “half” of the C++ standard (although in terms of page count it’s closer to three quarters than half). With a new C++20 standard on the horizon, and lots of new features that people want added to the standard library, the LWG has been very busy trying to process the backlog of new proposals forwarded by the Library Evolution Working Group (LEWG).
Continue reading “Report from the February 2019 ISO C++ meeting (Library)”
Red Hat Developer Toolset delivers GCC, GDB, and a set of complementary development tools for Red Hat Enterprise Linux via two release trains per year. We are pleased to share that Developer Toolset 8.1 with GCC 8.3 is now available and supported on Red Hat Enterprise Linux 7.
Continue reading “Developer Toolset 8.1 and GCC 8.3 now available for Red Hat Enterprise Linux 7”
In our previous article about Stack Clash, we covered the basics of the Stack Clash vulnerability. To summarize, an attacker first uses various means to bring the heap and stack close together. A large stack allocation is then used to “jump the stack guard.” Subsequent stores into the stack may modify objects in the heap or vice versa. This, in turn, can be used by attackers to gain control over applications.
GCC has a capability (
-fstack-check), which looked promising for mitigating Stack Clash attacks. This article will cover how
-fstack-check works and why it is insufficient for mitigating Stack Clash attacks.
Continue reading “Stack Clash mitigation in GCC: Why -fstack-check is not the answer”
The Linux perf tool was originally written to allow access to the performance monitoring hardware that counts hardware events, such as instructions executed, processor cycles, and cache misses. However, it can also be used to count software events, which can be useful in gauging how frequently some part of the system software is executed.
Recently someone at Red Hat asked whether there was a way to get a count of system calls being executed on the system. The kernel has a predefined software trace point,
raw_syscalls:sys_enter, which collects that exact information; it counts each time a system call is made. To use the trace point events, the
perf command needs to be run as root.
Continue reading “How to use the Linux perf tool to count software events”
Several months ago, I took over the maintenance of the flex package in Fedora and decided to kick the tires by rebasing the package in Fedora Rawhide. I downloaded and hashed the latest tarball at the time, flex-2.6.4, tweaked the spec file, and fired up a local build. Unfortunately, it failed with a
SIGSEGV at build time:
./stage1flex -o stage1scan.c ./scan.l
make: *** [Makefile:1695: stage1scan.c] Segmentation fault (core dumped)
Some debugging with gdb led me to the conclusion that the segmentation fault was the result of a block of memory returned from the
reallocarray function being written to during flex initialization. In this article, I’ll describe the issue further and explain changes made to address it.
Continue reading “Implicit function declarations: flex’s use of “reallocarray””
Red Hat Developer Toolset augments Red Hat Enterprise Linux with the latest, stable versions of GCC that install alongside the original base version. This version of Red Hat Developer Toolset 8.1 Beta includes the following new components:
- GCC 8.2.1
- GDB 8.2
- binutils 2.30
- elfutils 0.176
- Valgrind 3.14.0
This Beta release is supported on Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7 for AMD64 and Intel 64 architectures. It also supports the following architectures on Red Hat Enterprise Linux 7: 64-bit ARM, big- and little-endian variants of IBM POWER (), and IBM Z. See below for more information about each updated component.
Continue reading “Red Hat Developer Toolset 8.1 Beta now available”
One of the most important concepts introduced in C++11 was move semantics. Move semantics is a way to avoid expensive deep copy operations and replace them with cheaper move operations. Essentially, you can think of it as turning a deep copy into a shallow copy.
Move semantics came along with several more or less related features, such as rvalue references, xvalues, forwarding references, perfect forwarding, and so on. The standard C++ library gained a function template called
std::move, which, despite its name, does not move anything.
std::move merely casts its argument to an rvalue reference to allow moving it, but doesn’t guarantee a move operation. For example, we can write a more effective version of
void swap(T& a, T& b)
T t(std::move (a));
a = std::move (b);
b = std::move (t);
This version of swap consists of one move construction and two move assignments and does not involve any deep copies. All is well. However,
std::move must be used judiciously; using it blithely may lead to performance degradation, or simply be redundant, affecting readability of the code. Fortunately, the compiler can sometimes help with finding such wrong uses of
std::move. In this article, I will introduce two new warnings I’ve implemented for GCC 9 that deal with incorrect usage of
Continue reading “Understanding when not to std::move in C++”
A new version of the OpenMP standard, 5.0, was released in November 2018 and brings several new constructs to the users. OpenMP is an API consisting of compiler directives and library routines for high-level parallelism in C, C++, and Fortran programs. The upcoming version of GCC adds support for some parts of this newest version of the standard.
This article highlights some of the latest features, changes, and “gotchas” to look for in the OpenMP standard.
Continue reading “What’s new in OpenMP 5.0”
As part of the GCC developers‘ on-demand range work for GCC 10, I’ve been playing with improving the backward jump threader so it can thread paths that are range-dependent. This, in turn, had me looking at the jump threader, which is a part of the compiler I’ve been carefully avoiding for years. If, like me, you’re curious about compiler optimizations, but are jump-threading-agnostic, perhaps you’ll be interested in this short introduction.
Continue reading “A gentle introduction to jump threading optimizations”
In part 1, I shed light on trade-offs involved in the GCC implementation choices for various types of front-end warnings, such as preprocessor warnings, lexical warnings, type-safety warnings, and other warnings.
As useful as front-end warnings are, those based on the flow of control or data through the program have rather inconvenient limitations. To overcome them, flow-based warnings have increasingly been implemented in what GCC calls the “middle end.” Middle-end warnings are the focus of this article.
Continue reading “Understanding GCC warnings, Part 2”