]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/30147 (ICE in fold_convert with -O2)
authorRichard Guenther <rguenther@suse.de>
Tue, 12 Dec 2006 12:13:48 +0000 (12:13 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 12 Dec 2006 12:13:48 +0000 (12:13 +0000)
2006-12-12  Richard Guenther  <rguenther@suse.de>

PR middle-end/30147
* fold-const.c (fold_read_from_constant_string): Only fold read
from constant string if the result type is integer.

* gfortran.fortran-torture/compile/pr30147.f90: New testcase.

From-SVN: r119776

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90 [new file with mode: 0644]

index 406b52b5cc41845781915c443190ed32e9e79106..61f49fa745b27630970ee02f57a2e4b4fe1d8a7d 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-12  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/30147
+       * fold-const.c (fold_read_from_constant_string): Only fold read
+       from constant string if the result type is integer.
+
 2006-12-12  Olivier Hainque  <hainque@adacore.com>
 
        * config/rs6000/t-vxworks: Remove assignment to LIB2FUNCS_EXTRA.
index 0908e2840f2f0dbe69201ee34a6b62a16eb73f1c..f1f9c00226181ab81d23938eb1d44c96f761e544 100644 (file)
@@ -12726,7 +12726,9 @@ fold_unary_to_constant (enum tree_code code, tree type, tree op0)
 tree
 fold_read_from_constant_string (tree exp)
 {
-  if (TREE_CODE (exp) == INDIRECT_REF || TREE_CODE (exp) == ARRAY_REF)
+  if ((TREE_CODE (exp) == INDIRECT_REF
+       || TREE_CODE (exp) == ARRAY_REF)
+      && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE)
     {
       tree exp1 = TREE_OPERAND (exp, 0);
       tree index;
index 2846aaf001101b92fc8adad378b391ec6ca2a6cd..8e8c438739ea116f38b7741b2f67550619a3bf48 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-12  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/30147
+       * gfortran.fortran-torture/compile/pr30147.f90: New testcase.
+
 2006-12-11  Aldy Hernandez  <aldyh@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
 
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90
new file mode 100644 (file)
index 0000000..b9c1533
--- /dev/null
@@ -0,0 +1,14 @@
+MODULE input_cp2k_motion
+  IMPLICIT NONE
+  interface
+    SUBROUTINE keyword_create(variants)
+      CHARACTER(len=*), DIMENSION(:), &
+      INTENT(in)                   :: variants
+    end subroutine
+  end interface
+CONTAINS
+  SUBROUTINE create_neb_section()
+    CALL keyword_create(variants=(/"K"/))
+  END SUBROUTINE create_neb_section
+END MODULE input_cp2k_motion
+