]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/45576 (ICE on character stuff)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 7 Sep 2010 22:50:54 +0000 (22:50 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 7 Sep 2010 22:50:54 +0000 (22:50 +0000)
2010-09-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/45576
* dependency.c (gfc_deb_compare_expr):  Take missing optional
arguments into account.

2010-09-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/45576
* gfortran.dg/char_length_18.f90:  New test.

From-SVN: r163978

gcc/fortran/ChangeLog
gcc/fortran/dependency.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/char_length_18.f90 [new file with mode: 0644]

index 7a9f6781931083c4e9afad5dec574f2e30547aba..2215eb850dedeec431d53b92a1938fe2b9acdc42 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/45576
+       * dependency.c (gfc_deb_compare_expr):  Take missing optional
+       arguments into account.
+
 2010-09-08  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * trans.h (gfor_fndecl_clz128, gfor_fndecl_ctz128): Remove.
index 960155e04e3a568f91098eb85f31aa45d910146c..ab14e33df64aefdd2755809bb575e5f97fbf5b5c 100644 (file)
@@ -368,8 +368,14 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
          /* Compare the argument lists for equality.  */
          while (args1 && args2)
            {
-             if (gfc_dep_compare_expr (args1->expr, args2->expr) != 0)
+             /*  Bitwise xor, since C has no non-bitwise xor operator.  */
+             if ((args1->expr == NULL) ^ (args2->expr == NULL))
                return -2;
+
+             if (args1->expr != NULL && args2->expr != NULL
+                 && gfc_dep_compare_expr (args1->expr, args2->expr) != 0)
+               return -2;
+
              args1 = args1->next;
              args2 = args2->next;
            }
index 0c29f205bcdde6454bf7135577bf1cc222a2dc0f..b628e22a1e1fadf74aed9c8e46fc286db41a9d26 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-07  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/45576
+       * gfortran.dg/char_length_18.f90:  New test.
+
 2010-09-07  Jack Howarth <howarth@bromo.med.uc.edu>
 
        PR target/36502
diff --git a/gcc/testsuite/gfortran.dg/char_length_18.f90 b/gcc/testsuite/gfortran.dg/char_length_18.f90
new file mode 100644 (file)
index 0000000..9fd31c8
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR 45576 - no ICE for missing optional argument
+! Test case supplied by Joost VandeVondele
+SUBROUTINE get_r_val()
+  INTEGER, PARAMETER :: default_string_length=128
+  CHARACTER(len=default_string_length) :: c_val
+  LOGICAL                              :: check 
+  check = c_val(LEN_TRIM(c_val):LEN_TRIM(c_val))=="]"
+END SUBROUTINE get_r_val