[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Re: PR82943: Error: Argument 'this' of 'foo' with PASS(this) at (1) must be of the derived-type 'typ
From:       Steve Kargl <sgk () troutmask ! apl ! washington ! edu>
Date:       2017-11-25 2:21:33
Message-ID: 20171125022133.GA33559 () troutmask ! apl ! washington ! edu
[Download RAW message or body]

On Fri, Nov 24, 2017 at 04:55:33PM -0800, Darrell Reich via fortran wrote:
> Now that I've rebuilt the latest gfortran 8 from source using
> Cygwin, how do I debug this?

I'm not sure how one debugs under cygwin.  First, reduce the
code to the smallest possible length that exhibits the problems
(it makes debugging easier).  If you were on UNIX, you can grep
for the error message in gcc/fortran/*.c code.  Once you have a
line number, say N, in some_file.c, then use gdb on f951 to set
a break point at that line and run your code.  For example, 
on my system

% gdb801 ~/work/libexec/gcc/i586-unknown-freebsd12.0/8.0.0/f951
(gdb) break decl.c:4660
Breakpoint 1 at 0x82cd9b0: file ../../gcc/gcc/fortran/decl.c, line 4660.
(gdb) run -fcoarray=single a.f90

Here I specific the needed -fcorray=single option.  After a bunch
of output due to a.f90, I get

breakpoint 1, match_attr_spec (length_selector_comma=<optimized out>)
    at ../../gcc/gcc/fortran/decl.c:4665
4665                    d = DECL_EXTERNAL;

You can now exam nearby data structures and get a backtrace.
(gdb) bt
#0  match_attr_spec (length_selector_comma=<optimized out>)
    at ../../gcc/gcc/fortran/decl.c:4665
#1  0x082d2957 in gfc_match_data_decl() () at ../../gcc/gcc/fortran/decl.c:5678
#2  0x083291cc in match_word (str=str@entry=0x0, subr=<optimized out>, 
    old_locus=old_locus@entry=0xbfbfe118) at ../../gcc/gcc/fortran/parse.c:65
#3  0x0832bd0f in decode_statement () at ../../gcc/gcc/fortran/parse.c:376
#4  0x0832d6d5 in next_free () at ../../gcc/gcc/fortran/parse.c:1225
#5  next_statement() () at ../../gcc/gcc/fortran/parse.c:1457
#6  0x0832f004 in parse_spec(gfc_statement) ()
    at ../../gcc/gcc/fortran/parse.c:3835
#7  0x08332469 in parse_module () at ../../gcc/gcc/fortran/parse.c:5901
#8  0x08332b13 in gfc_parse_file() () at ../../gcc/gcc/fortran/parse.c:6214
#9  0x083738f8 in gfc_be_parse_file () at ../../gcc/gcc/fortran/f95-lang.c:204
#10 0x0876870d in compile_file () at ../../gcc/gcc/toplev.c:455
#11 0x082ac0a4 in do_compile () at ../../gcc/gcc/toplev.c:2059
#12 toplev::main(int, char**) () at ../../gcc/gcc/toplev.c:2194
#13 0x082ae371 in main (argc=3, argv=0xbfbfe670) at ../../gcc/gcc/main.c:39

At this point, you'll need to get familiar with gfortran internals.

> From reading over the other threads, how is it decided when to push
> down to 6.4 and 7.2 streams?

The normal workflow is 

1) Develop patch against trunk.
2) Submit patch to fortran@ and gcc-patches@.
3) After review and approval, commit patch to trunk.

This is were decisions for other branches are made.

4) If this is a new feature such as Paul's recent parameterized 
   derived types.  You are done.  Back ports to the branches are
   discouraged to prevent possible regressions (or require a really,
   really, good reason is needed).

5) If a bug is a regression in a branch, then the patch is a candidate
   for a back port.  A regression is code that had compiled prior
   to some change in a branch and it no longer does.  It is usually
   up to the committer to do the back port.  If he feels that a back
   port may be too intrusive, then he may opt to not back port. 

6) If a bug is not a regression then a back port is discouraged (again
   the possibility of causing new regressions is the problem).  gfortran
   developers have played a little loose with this rule.  Typically,
   the developers tended to back port to the most recent branch to try to
   keep the branch in sync with trunk.  Historically, we had too many bugs
   and new features to implement, and too few hands available.   Keeping
   the branch and trunk synced as long as possible eased maintenance.

-- 
Steve
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic