Search papers, labs, and topics across Lattice.
This study empirically investigates the prevalence of undefined behavior in C and C++ through an experiment involving 59 desktop tasks on a Linux distribution. The findings reveal that nearly 11,000 unique undefined behavior warnings were generated across 32 programs, predominantly linked to the Mesa graphics library and user interface interactions, with a significant number of warnings stemming from virtual table pointer issues. This highlights the pervasive nature of undefined behavior in everyday programming scenarios, underscoring the need for better awareness and handling of such issues in software development.
Nearly 11,000 warnings of undefined behavior were triggered by typical desktop interactions, revealing a critical oversight in C and C++ programming practices.
Undefined behavior is idiomatic to C and C++ programming; such behavior is a use of an erroneous program construct for which the languages impose no requirements, such as integer overflows. The paper presents an empirical experiment seeking to probe the extent of undefined behavior executing underneath typical desktop use of a Linux distribution. The analysis is based on an undefined behavior sanitizer implemented in a compiler. According to the results, undefined behavior is common. By completing 59 simple experimental tasks, nearly 11 thousand unique undefined behavior warnings were generated by 32 unique programs and libraries written in C or C++. Of these warnings, most were associated with the Mesa graphics library and generated by interacting with graphical user interfaces. Merely logging into the GNOME desktop environment generated over 500 unique warnings. Of all warnings, the clear majority was about virtual table pointers. The associated stack traces were also lengthy in general. With these and other results, the paper contributes to the empirical literature on C and C++.