[gfortran, committed] Fix PR17676 : segfault with user defined operators

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Fri Oct 8 00:32:00 GMT 2004


This obvious patch fixes a segfault which surprisingly only appeared on sparc.
On i686-pc-linux we take the exact same code path (everything else would be an
error), and don't segfault, even though e->uop->ns is NULL. Maybe some
compiler builtin or macro magic masked the error. I had forgotten about this
patch which had been lying around for two weeks.

Built and tested, committed under the obviously correct rule.

- Tobi

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/ChangeLog,v
retrieving revision 1.232
diff -u -p -r1.232 ChangeLog
--- ChangeLog   7 Oct 2004 15:12:01 -0000       1.232
+++ ChangeLog   7 Oct 2004 23:52:03 -0000
@@ -1,5 +1,10 @@
 2004-10-07  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

+       PR fortran/17676
+       * resolve.c (resolve_operator): Use correct operator name in message.
+
+2004-10-07  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
        * primary.c (match_boz_constant): Allow kind parameter suffixes.
        Move standard warning further to the front.

Index: resolve.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/resolve.c,v
retrieving revision 1.19
diff -u -p -r1.19 resolve.c
--- resolve.c   16 Sep 2004 16:00:42 -0000      1.19
+++ resolve.c   7 Oct 2004 23:52:04 -0000
@@ -1413,10 +1413,10 @@ resolve_operator (gfc_expr * e)
     case INTRINSIC_USER:
       if (op2 == NULL)
        sprintf (msg, "Operand of user operator '%s' at %%L is %s",
-                e->uop->ns->proc_name->name, gfc_typename (&op1->ts));
+                e->uop->name, gfc_typename (&op1->ts));
       else
        sprintf (msg, "Operands of user operator '%s' at %%L are %s/%s",
-                e->uop->ns->proc_name->name, gfc_typename (&op1->ts),
+                e->uop->name, gfc_typename (&op1->ts),
                 gfc_typename (&op2->ts));

       goto bad_op;



More information about the Gcc-patches mailing list