[patch, libgfortran] PR43899 Wrong unused-variable warning with NAMELISTs

Jerry DeLisle jvdelisle@frontier.com
Wed Nov 3 05:58:00 GMT 2010


This PR is about two issues.  The first is a bogus warning about the variable 
being unused when -Wall is being used.  The second issue has to do with warning 
a user when a namelist read of a character object is truncated. Only the second 
issue is addressed here.

As Tobias points out, the test case is legal.  The attached patch adds a new 
runtime warning function to libgfortran and uses it in list_read.c if the test 
case has been compiled with -fbounds-check.  The warning is issued to stderr, 
and execution proceeds normally.

This will give users an opportunity to debug code that may unintentionally have 
an issue.

The runtime warning will also be useful down the road.

Regression tested on x86-64-linux-gnu.  OK for trunk.

Regards,

Jerry

2010-11-02  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/43899
	* runtime/error.c (generate_error): New function to generate a run
	time warning message. Fix some whitespace.
	* gfortran.map: Add symbol for new function.
	* libgfortran.h: Add prototype for new function.
	* io/list_read.c (nml_read_obj): Use new function to warn when a
	character namelist object is truncated.  Only warn if compiled
	with -fbounds-check.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr43899.diff
Type: text/x-patch
Size: 2662 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/814c9222/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: namelist_67.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/814c9222/attachment.f90>


More information about the Gcc-patches mailing list