Dear all, I would like to participate in the Google Summer of Code with GCC as the mentoring organisation working in the project described below. This is a draft of the project proposal I am preparing to submit to Google. Any comments and suggestions (and criticism) are welcome. Also, if someone wants to participate as a mentor for this project [*], please get in contact with Ian Lance Taylor <ian at airs dot com> and me.
Thanks in advance, Manuel López-Ibáñez. [*] http://code.google.com/soc/mentorfaq.html Google Summer of Code Project Proposal Wcoercion option: warn of any implicit conversion that may change a value Manuel López-Ibáñez ([EMAIL PROTECTED]) ------- Summary ------- The goal of this project is to develop an option warning of any implicit conversion that may change a value. Examples of such conversions are passing a double value to a function declared to receive a float argument and setting a signed constant to an unsigned variable. The option should not warn of explicit conversions or of cases where the value cannot in fact change despite the implicit conversion. These options would be particularly useful for security auditing and scientific applications. --------- Rationale --------- In its most recent version, GCC features only a handful of warning options for potentially problematic type conversions. As explained in the GCC manual page, the option Wsign-compare warns of comparisons between signed and unsigned values that could produce an incorrect result when the signed value is converted to unsigned. In addition, the Wconversion option "warns if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of such prototype". Wconversion also warns if a negative integer constant expression is implicitly converted into an unsigned type. In particular, Wconversion is frequently misused to warn about type conversions that may change a value[1]. The confusion between the documented behaviour and the intention of the user often results in numerous warnings for perfectly working code [2][3]. Moreover, there have been proposals for dividing the two different behaviours of Wconversion into two distinct options [4], and for renaming Wconversion and creating a new option[5][6]. The proposal of Joseph Myers[6] defines the basic goal of this project, which is to create a new option: Wcoercion. This new option will warn for any implicit conversion that may alter a value. Such option is common in other compilers [7] and it has been mentioned as a desirable feature in GCC [8]. ------- Roadmap ------- * Documentation: writing a clear description of the new option, the cases where it should apply and its expected behaviour. A short description of the option purpose would be the basis of its description in the manual of GCC. * Coding of the testcases into an example program. This program would be the basis for testing the new option. * Implementation of the option. This will be accomplished in several steps. First the basic infrastructure for the option will be added. Then, each testcase may be implemented as an individual patch. The implementation would be based on that of Wconversion and Wsign-compare. I understand that the code may not be incorporated into GCC's main development trunk during the Summer of Code 2006. Therefore, my intention is to synchronise the patch with the latest version of GCC until the code is ready to be integrated into the main development trunk, after the work developed for the Google Summer of Code. Finally, I intend to follow the guidelines of contribution to GCC [9] and any advice received from GCC developers. -------- About me -------- My name is Manuel López-Ibáñez, I was born in 1980 in Spain. I studied Computer Engineering (5 years degree) at the University of Granada (Spain). Currently, I am pursuing a PhD by thesis at Napier University in Edinburgh (United Kingdom). Website: http://sbe.napier.ac.uk/~manuel/ The motivation for this project arised when I misused the Wconversion option for warning about implicit conversions in a scientific library. Then, I started gathering information about the current status of Wconversion as well as the possibility and importance of a new option. I have good knowledge of both C and Subversion and I am used to working with patches and GNU tools. I am genuinely looking forward to learning from this project. I hope my relevant abilities and a little help from the community will suffice to make this project useful for everybody. [1] http://groups.google.com/group/gnu.gcc.bug/msg/1e8545e6b7e03320 [2] http://www.gnu.org/software/libc/FAQ.html#s-3.17 [3] http://gcc.gnu.org/ml/gcc-bugs/1999-08n/msg00591.html [4] http://lists.debian.org/debian-gcc/2002/12/msg00159.html [5] http://lists.debian.org/debian-gcc/2003/02/msg00079.html [6] http://www.srcf.ucam.org/~jsm28/gcc/#Wconversion [7] http://gcc.gnu.org/ml/gcc/2005-12/msg00272.html [8] http://gcc.gnu.org/ml/gcc/2004-06/msg01332.html [9] http://gcc.gnu.org/contribute.html