public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/52469] [4.6/4.7/4.8 Regression] -fwhole-file bug: Wrong backend_decl for result of PPC function
Date: Mon, 05 Mar 2012 20:32:00 -0000	[thread overview]
Message-ID: <bug-52469-4-jVMmwgts3r@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52469-4@http.gcc.gnu.org/bugzilla/>

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-05 20:31:58 UTC ---
WITH -fno-whole-file:

(gdb) b trans-expr.c:2249
...
Breakpoint 1, get_proc_ptr_comp (e=0x16d6420) at
/projects/tob/gcc-git/gcc/gcc/fortran/trans-expr.c:2249
2249      e2->expr_type = old_type;
(gdb) p debug_tree (comp_se.expr->typed.type)
 <function_type 0x2aaaacfb8b28
    type <real_type 0x2aaaacea1e70 real(kind=4) SF


WITH -fwhole-file:

(gdb) p debug_tree (comp_se.expr->typed.type)
 <pointer_type 0x2aaaacfb8bd0
    type <function_type 0x2aaaacfb8b28
        type <real_type 0x2aaaacea1e70 real(kind=4) SF


 * * *

Ignoring the difference, I tried:

--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2250,2 +2250,4 @@ get_proc_ptr_comp (gfc_expr *e)
   gfc_free_expr (e2);
+  if (POINTER_TYPE_P (TREE_TYPE (comp_se.expr)))
+    return comp_se.expr; 
   return build_fold_addr_expr_loc (input_location, comp_se.expr);


However, that leads to a segfault at run time in the WRITE line - even though
the dump looks OK:

      real(kind=4) D.1871;
      static real(kind=4) C.1870 = 3.0e+0;
      D.1871 = newtype[1].my_f_ptr (&C.1870);
      _gfortran_transfer_real_write (&dt_parm.0, &D.1871, 4);

 * * *

I tried to find out what's the difference between -f(no-)whole file, but so far
without success. "gfc_get_ppc_type" is in both cases only called once and
returns a
 <pointer_type 0x2aaaacfb8bd0
    type <function_type 0x2aaaacfb8b28

Once, it is called directly:
  gfc_get_symbol_decl -> gfc_sym_type -> gfc_typenode_for_spec
  -> gfc_get_derived_type

And once indirectly:

  gfc_get_symbol_decl -> gfc_sym_type -> gfc_typenode_for_spec
  -> gfc_get_derived_type -> gfc_get_module_backend_decl ->
gfc_get_derived_type


  parent reply	other threads:[~2012-03-05 20:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03 16:32 [Bug fortran/52469] New: Defining function pointer interface palott at gmail dot com
2012-03-03 16:35 ` [Bug fortran/52469] " palott at gmail dot com
2012-03-04 22:38 ` [Bug fortran/52469] [4.6/4.7/4.8 Regression] " dominiq at lps dot ens.fr
2012-03-05  8:19 ` [Bug fortran/52469] [4.6/4.7/4.8 Regression] -fwhole-file bug: Wrong backend_decl for result of PPC function burnus at gcc dot gnu.org
2012-03-05 20:32 ` burnus at gcc dot gnu.org [this message]
2012-03-08 11:33 ` burnus at gcc dot gnu.org
2012-03-08 19:37 ` burnus at gcc dot gnu.org
2012-03-10  8:19 ` burnus at gcc dot gnu.org
2012-03-10  9:21 ` burnus at gcc dot gnu.org
2012-03-10  9:22 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52469-4-jVMmwgts3r@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).