public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug fortran/26155] p cos(alat(j)) command make gdb Aborted (core dumped)
Date: Wed, 03 Feb 2021 12:40:38 +0000	[thread overview]
Message-ID: <bug-26155-4717-KAmkj9DG0s@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26155-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26155

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |andrew.burgess at embecosm dot com
                   |                            |, vries at gcc dot gnu.org
   Last reconfirmed|                            |2021-02-03
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduced:
...
$ gfortran test.F90 -g -O0
$ gdb -batch a.out -ex start -ex "p cos(10)"
Temporary breakpoint 1 at 0x400b3d: file test.F90, line 31.

Temporary breakpoint 1, MAIN__ () at test.F90:31
31          DO i = 1, n
Aborted (core dumped)
...

In more detail:
...
Temporary breakpoint 1, MAIN__ () at test.F90:31
31          DO i = 1, n

Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x00000000006ab78e in evaluate_subexp_f (expect_type=0x0, exp=0x2067bf0,
pos=0x7fffffffd3bc, 
    noside=EVAL_NORMAL) at gdb/f-lang.c:938
938                           = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem -
1);
...

So tem is:
...
(gdb) p tem
$2 = 1
...
and value_type (arg1) is :
...
(gdb) p value_type (arg1)
$1 = (type *) 0x21cc140
(gdb) call recursive_dump_type ($1, 0)
type node 0x21cc140
name '<text gnu-indirect-function variable, no debug info>' (0xe5f160)
code 0x7 (TYPE_CODE_FUNC)
length 1
objfile 0x224c490
target_type 0x0
pointer_type 0x0
reference_type 0x0
type_chain 0x21cc140
instance_flags 0x0
flags
nfields 0 0x0
calling_convention 0
...

So, we do TYPE_FIELD_ARTIFICIAL($1, 0).

The macro TYPE_FIELD_ARTIFICIAL is defined like this:
...
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field
(n))
...
so we try to access field 0 of type $1, but the type has no fields (see nfields
in the recursive type dump).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2021-02-03 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  1:26 [Bug fortran/26155] New: " yansendao at huawei dot com
2021-02-03 12:40 ` vries at gcc dot gnu.org [this message]
2021-02-03 12:49 ` [Bug fortran/26155] " vries at gcc dot gnu.org
2021-02-25 10:33 ` cvs-commit at gcc dot gnu.org
2021-02-25 10:43 ` andrew.burgess at embecosm dot com
2021-02-25 11:58 ` vries at gcc dot gnu.org
2021-02-25 12:00 ` vries at gcc dot gnu.org
2021-02-25 14:45 ` tromey at sourceware dot 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-26155-4717-KAmkj9DG0s@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).