Bug 45564 - gfortran.dg/achar_4.f90 ICE: verify_gimple failed: type mismatch in comparison expression with -fbounds-check
Summary: gfortran.dg/achar_4.f90 ICE: verify_gimple failed: type mismatch in compariso...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Mikael Morin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-06 20:41 UTC by Zdenek Sojka
Modified: 2010-09-07 16:09 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-09-06 22:20:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-09-06 20:41:51 UTC
Compiler output:
$ gcc -fbounds-check achar_4.f90 
achar_4.f90: In function 'up':
achar_4.f90:10:0: error: type mismatch in comparison expression
integer(kind=8)
integer(kind=8)
integer(kind=4)
D.1758 = D.1594 != 1;

achar_4.f90:10:0: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r163921 - crash
r158095 - crash
Comment 1 Dominique d'Humieres 2010-09-06 22:17:15 UTC
Confirmed on x86_64-apple-darwin10. The ICE disappears with -m32 and does not show up on builds with --enable-checking=release.
Comment 2 Mikael Morin 2010-09-06 22:20:15 UTC
Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c	(r��vision 163809)
+++ trans-intrinsic.c	(copie de travail)
@@ -4612,7 +4612,7 @@
 
   se->expr = info->descriptor;
   if (expr->ts.type == BT_CHARACTER)
-    se->string_length = dest_word_len;
+    se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len);
 
   return;
 
Comment 3 Mikael Morin 2010-09-07 16:05:44 UTC
Subject: Bug 45564

Author: mikael
Date: Tue Sep  7 16:04:55 2010
New Revision: 163958

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163958
Log:
2010-09-07  Mikael Morin  <mikael@gcc.gnu.org>

	* trans-stmt.c (gfc_trans_character_select): Be conversion-safe while
	checking string length value.
	* trans-intrinsic.c (gfc_conv_intrinsic_char): Build integer using
	gfc_charlen_type_node type.

	PR fortran/45564
	* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Convert string
	length to gfc_charlen_type_node.

2010-09-07  Mikael Morin  <mikael@gcc.gnu.org>

	* gfortran.dg/achar_4.f90: Enable bounds checking.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/achar_4.f90

Comment 4 Mikael Morin 2010-09-07 16:09:42 UTC
Fixed.