This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/36592] F2003: Procedure pointer in COMMON



------- Comment #2 from burnus at gcc dot gnu dot org  2008-09-22 20:22 -------
(In reply to comment #1)
> Created an attachment (id=16381)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16381&action=view) [edit]
> Although this test case compiles without error, it gives the wrong output:

If you had used -fdump-tree-original, you knew that you created a simple local
procedure pointer, which is not in common and thus a NaN or a crash or ...
makes sense. Not surprisingly the culprit is the if (proc_pointer) {one line}
else { lots of lines } in trans-common.c.

How about the following patch?

$ svn revert trans-common.c
$ patch <<EOF
--- trans-types.c       (Revision 140559)
+++ trans-types.c       (Arbeitskopie)
@@ -1629,0 +1630,9 @@ gfc_sym_type (gfc_symbol * sym)
+  if (sym->attr.proc_pointer)
+    {
+      /* Unset proc_pointer as gfc_get_function_type calls gfc_sym_type.  */
+      sym->attr.proc_pointer = 0;
+      type = build_pointer_type (gfc_get_function_type (sym));
+      sym->attr.proc_pointer = 1;
+      return type;
+    }
+
EOF

PS: You should reorder the items in COMMON as on x86-64 the pointers are
8-bytes wide, which causes a alignment/padding warning be printed.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-22 20:22:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36592


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]