public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug symtab/15695] New: value_struct_elt dereferences entire ptr chain? Date: Thu, 27 Jun 2013 20:24:00 -0000 [thread overview] Message-ID: <bug-15695-4717@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=15695 Bug ID: 15695 Summary: value_struct_elt dereferences entire ptr chain? Product: gdb Version: HEAD Status: NEW Severity: minor Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: dje at google dot com While debugging an infinite loop in gdb I found it occurred here: value_struct_elt: while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ if (TYPE_CODE (value_type (*argp)) != TYPE_CODE_FUNC) *argp = coerce_array (*argp); t = check_typedef (value_type (*argp)); } The comment for value_struct_elt says: /* Given *ARGP, a value of type (pointer to a)* structure/union, There's no suggestion of *ARGP being a pointer to a pointer to a pointer to ... a pointer to a struct/union. If this is an ease of use feature for the user, this seems like too low a level a routine to implement this feature. One possibility is that the loop is just a simple way to handle ptr->ref, with ptr->ptr->ptr->... being accidental fallout. IWBN to clarify this. The TYPE_CODE (value_type (*argp)) needs a call to check_typedef. Another related bug is why is there a check for a function inside the loop? We're only interested in structs/unions here. I suspect it's because coerce_array is misnamed/confusing: it also coerces functions to be pointer to functions. And if we didn't do the check we would be stuck in an infinite loop. Alas we still are in an infinite loop if *argp is ptr->typedef->func. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2013-06-27 20:24 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-27 20:24 dje at google dot com [this message] 2013-08-01 23:59 ` [Bug symtab/15695] " cvs-commit at gcc dot gnu.org 2024-01-11 16:43 ` ssbssa 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-15695-4717@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: linkBe 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).