[multiple changes]

2007-01-09  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30408
	* resolve.c (resolve_code): Use the code->expr character length
	directly to set length of llen.

2007-01-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/30408
	* lang.opt: Add Wcharacter_truncation option.
	* options.c (gfc_init_options): Initialize
	gfc_option.warn_character_truncation to zero.
	(gfc_handle_option): Add case for OPT_Wcharacter_truncation.

From-SVN: r120632
This commit is contained in:
Jerry DeLisle 2007-01-10 04:34:34 +00:00
parent c49a1f9ee8
commit 0b30ba3b6c
4 changed files with 28 additions and 5 deletions

View File

@ -1,9 +1,22 @@
2007-01-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30408
* resolve.c (resolve_code): Use the code->expr character length
directly to set length of llen.
2007-01-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/30408
* lang.opt: Add Wcharacter_truncation option.
* options.c (gfc_init_options): Initialize
gfc_option.warn_character_truncation to zero.
(gfc_handle_option): Add case for OPT_Wcharacter_truncation.
2007-01-08 Steven G. Kargl <kargl@gcc.gnu.org>
* interface.c, intrinsic.c, gfortranspec.c, io.c, f95-lang.c,
iresolve.c, match.c: Update Copyright years. Whitespace.
2007-01-08 Richard Guenther <rguenther@suse.de>
* trans-io.c (transfer_array_desc): Use build_int_cst instead

View File

@ -45,6 +45,10 @@ Wampersand
Fortran
Warn about missing ampersand in continued character constants
Wcharacter-truncation
Fortran
Warn about truncated character expressions
Wconversion
Fortran
Warn about implicit conversion

View File

@ -59,6 +59,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.warn_aliasing = 0;
gfc_option.warn_ampersand = 0;
gfc_option.warn_character_truncation = 0;
gfc_option.warn_conversion = 0;
gfc_option.warn_implicit_interface = 0;
gfc_option.warn_line_truncation = 0;
@ -410,6 +411,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
gfc_option.warn_ampersand = value;
break;
case OPT_Wcharacter_truncation:
gfc_option.warn_character_truncation = value;
break;
case OPT_Wconversion:
gfc_option.warn_conversion = value;
break;

View File

@ -5088,10 +5088,11 @@ resolve_code (gfc_code * code, gfc_namespace * ns)
&& gfc_option.warn_character_truncation)
{
int llen = 0, rlen = 0;
gfc_symbol *sym;
sym = code->expr->symtree->n.sym;
if (sym->ts.cl->length->expr_type == EXPR_CONSTANT)
llen = mpz_get_si (sym->ts.cl->length->value.integer);
if (code->expr->ts.cl != NULL
&& code->expr->ts.cl->length != NULL
&& code->expr->ts.cl->length->expr_type == EXPR_CONSTANT)
llen = mpz_get_si (code->expr->ts.cl->length->value.integer);
if (code->expr2->expr_type == EXPR_CONSTANT)
rlen = code->expr2->value.character.length;