Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1450058.1450093acmconferencesArticle/Chapter ViewAbstractPublication PagesesweekConference Proceedingsconference-collections
research-article

Volatiles are miscompiled, and what to do about it

Published: 19 October 2008 Publication History

Abstract

C's volatile qualifier is intended to provide a reliable link between operations at the source-code level and operations at the memory-system level. We tested thirteen production-quality C compilers and, for each, found situations in which the compiler generated incorrect code for accessing volatile variables. This result is disturbing because it implies that embedded software and operating systems---both typically coded in C, both being bases for many mission-critical and safety-critical applications, and both relying on the correct translation of volatiles---may be being miscompiled.
Our contribution is centered on a novel technique for finding volatile bugs and a novel technique for working around them. First, we present access summary testing: an efficient, practical, and automatic way to detect code-generation errors related to the volatile qualifier. We have found a number of compiler bugs by performing access summary testing on randomly generated C programs. Some of these bugs have been confirmed and fixed by compiler developers. Second, we present and evaluate a workaround for the compiler defects we discovered. In 96% of the cases in which one of our randomly generated programs is miscompiled, we can cause the faulty C compiler to produce correctly behaving code by applying a straightforward source-level transformation to the test program.

References

[1]
Hans Boehm and Nick Maclaren. Should volatile acquire atomicity and thread visibility semantics? WG21 Paper N2016, ISO, April 2006. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2016.html.
[2]
Digital Equipment Corporation. DDT kits. http://nar-associates.com/site/sdr/projects/ddt/download/kits/, December 1996.
[3]
Free Software Foundation. GCC, the GNU compiler collection. http://gcc.gnu.org/, 2008.
[4]
Freescale Semiconductor, Inc. CodeWarrior Development Studio. http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0127262E70, 2008.
[5]
Douglas Gwyn. NEVERMIND! (was: Re: A question on volatile accesses). USENET post to comp.std.c, November 1990. http://groups.google.com/group/comp.std.c/msg/7709e4162620f2cd.
[6]
Intel Corporation. Intel C++ Compiler 10.1, professional and standard editions, for Linux. http://www.intel.com/cd/software/products/asmo-na/eng/compilers/277618.htm, 2008.
[7]
International Organization for Standardization. ISO/IEC 9899:TC2: Programming Languages -- C, May 2005. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf.
[8]
International Organization for Standardization. Information technology -- programming languages -- C -- extensions to support embedded processors. ISO/IEC draft Technical Report 18037, ISO, April 2006. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf.
[9]
Philip Levis et al. T2: A second generation OS for embedded sensor networks. Technical Report TKN-05-007, Telecommunication Networks Group, Technische Universitaet Berlin, November 2005.
[10]
Christian Lindig. Random testing of C calling conventions. In Proc. 6th Intl. Symp. on Automated Analysis-Driven Debugging (AADEBUG), pages 3--12, September 2005.
[11]
Christian Lindig. Quest - an extensible test-code generator for C. http://code.google.com/p/quest-tester/, 2007.
[12]
LLVM Team, University of Illinois at Urbana-Champaign. The LLVM compiler infrastructure project. http://llvm.org/, 2008.
[13]
William M. McKeeman. Differential testing for software. Digital Technical Journal, 10(1):100--107, December 1998.
[14]
George C. Necula, Scott McPeak, S. P. Rahul, and Westley Weimer. CIL: Intermediate language and tools for analysis and transformation of C programs. In Proc. Intl. Conf. on Compiler Construction (CC), pages 213--228, April 2002.
[15]
Nicholas Nethercote and Julian Seward. Valgrind: A framework for heavyweight dynamic binary instrumentation. In Proc. 2007 ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI), pages 89--100, June 2007.
[16]
NULLSTONE Corporation. NULLSTONE for C. http://www.nullstone.com/htmls/ns-c.htm, 2007.
[17]
Flash Sheridan. Practical testing of a C99 compiler using output comparison. Software - Practice and Experience, 37(14):1475--1488, November 2007.
[18]
Steve Summit. comp.lang.c frequently asked questions. http://c-faq.com/.
[19]
Sun Microsystems, Inc. Sun Studio 12 C, C++, and Fortran compilers and tools. http://developers.sun.com/sunstudio/, 2008.
[20]
Ben L. Titzer and Jens Palsberg. Nonintrusive precision instrumentation of microcontroller software. In Proc. 2005 Conf. on Languages, Compilers, and Tools for Embedded Systems (LCTES), pages 59--68, June 2005.
[21]
Bryan Turner. Random C program generator. http://brturn.googlepages.com/randomcprogramgenerator, January 2007.
[22]
Brian White et al. An integrated experimental environment for distributed systems and networks. In Proc. 5th Symposium on Operating Systems Design and Implementation (OSDI), pages 255--270, December 2002.

Cited By

View all
  • (2024)Rustlantis: Randomized Differential Testing of the Rust CompilerProceedings of the ACM on Programming Languages10.1145/36897808:OOPSLA2(1955-1981)Online publication date: 8-Oct-2024
  • (2024)Revealing Compiler Heuristics through Automated Discovery and OptimizationProceedings of the 2024 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO57630.2024.10444847(55-66)Online publication date: 2-Mar-2024
  • (2024)Compiler Testing with Relaxed Memory ModelsProceedings of the 2024 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO57630.2024.10444836(334-348)Online publication date: 2-Mar-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
EMSOFT '08: Proceedings of the 8th ACM international conference on Embedded software
October 2008
284 pages
ISBN:9781605584683
DOI:10.1145/1450058
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 October 2008

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. automated testing
  2. compiler defect
  3. compiler testing
  4. random program generation
  5. random testing
  6. volatile

Qualifiers

  • Research-article

Conference

ESWEEK 08
ESWEEK 08: Fourth Embedded Systems Week
October 19 - 24, 2008
GA, Atlanta, USA

Acceptance Rates

Overall Acceptance Rate 60 of 203 submissions, 30%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)28
  • Downloads (Last 6 weeks)0
Reflects downloads up to 27 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Rustlantis: Randomized Differential Testing of the Rust CompilerProceedings of the ACM on Programming Languages10.1145/36897808:OOPSLA2(1955-1981)Online publication date: 8-Oct-2024
  • (2024)Revealing Compiler Heuristics through Automated Discovery and OptimizationProceedings of the 2024 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO57630.2024.10444847(55-66)Online publication date: 2-Mar-2024
  • (2024)Compiler Testing with Relaxed Memory ModelsProceedings of the 2024 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO57630.2024.10444836(334-348)Online publication date: 2-Mar-2024
  • (2023)Testing the Compiler for a New-Born Programming Language: An Industrial Case Study (Experience Paper)Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3597926.3598077(551-563)Online publication date: 12-Jul-2023
  • (2023)Boosting Compiler Testing via Eliminating Test Programs with Long-Execution-Time2023 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER56733.2023.00061(593-603)Online publication date: Mar-2023
  • (2022)Remgen: Remanufacturing a Random Program Generator for Compiler Testing2022 IEEE 33rd International Symposium on Software Reliability Engineering (ISSRE)10.1109/ISSRE55969.2022.00057(529-540)Online publication date: Oct-2022
  • (2022)Automated Vulnerable Codes Mutation through Deep Learning for Variability Detection2022 International Joint Conference on Neural Networks (IJCNN)10.1109/IJCNN55064.2022.9892444(1-8)Online publication date: 18-Jul-2022
  • (2021)Safe-by-default Concurrency for Modern Programming LanguagesACM Transactions on Programming Languages and Systems10.1145/346220643:3(1-50)Online publication date: 3-Sep-2021
  • (2020)Random testing for C and C++ compilers with YARPGenProceedings of the ACM on Programming Languages10.1145/34282644:OOPSLA(1-25)Online publication date: 13-Nov-2020
  • (2020)Adversarial Examples on Object RecognitionACM Computing Surveys10.1145/339839453:3(1-38)Online publication date: 12-Jun-2020
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media