public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: apwingo@eos.ncsu.edu To: gcc-gnats@gcc.gnu.org Subject: c/3440: pointer to a struct changes when no assignment has been made to it Date: Wed, 27 Jun 2001 08:26:00 -0000 [thread overview] Message-ID: <20010627151904.32184.qmail@sourceware.cygnus.com> (raw) >Number: 3440 >Category: c >Synopsis: pointer to a struct changes when no assignment has been made to it >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Wed Jun 27 08:26:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Andy Wingo >Release: gcc version 2.95.4 20010604 (Debian prerelease) >Organization: >Environment: Debian GNU/Linux unstable, updated last night (6/27) >Description: the 'd' pointer changes when the LADSPA_IS_PORT_INPUT macro is called. Here is the cpp'd code: static gboolean has_inp_out (const LADSPA_Descriptor *d, gint inp, gint out) { gint inp_count, out_count, i; inp_count = 0; out_count = 0; for (i=0; i < d->PortCount; i++) { if ((( d->PortDescriptors[i] ) & 0x1 ) && (( d->PortDescriptors[i] ) & 0x8 ) ) inp_count++; if ((( d->PortDescriptors[i] ) & 0x2 ) && (( d->PortDescriptors[i] ) & 0x8 ) ) out_count++; } if (inp_count==inp && out_count==out) return TRUE; else return FALSE; } Right in the first if, d changes to be equal to d->PortDescriptors. I've debugged this and it is repeatable. Here is the assembler that gets produced: Dump of assembler code for function has_inp_out: 0x80557ec <has_inp_out>: push %ebp 0x80557ed <has_inp_out+1>: mov %esp,%ebp 0x80557ef <has_inp_out+3>: sub $0xc,%esp 0x80557f2 <has_inp_out+6>: push %edi 0x80557f3 <has_inp_out+7>: push %esi 0x80557f4 <has_inp_out+8>: push %ebx 0x80557f5 <has_inp_out+9>: mov 0x8(%ebp),%edx 0x80557f8 <has_inp_out+12>: xor %esi,%esi 0x80557fa <has_inp_out+14>: xor %ebx,%ebx 0x80557fc <has_inp_out+16>: xor %ecx,%ecx 0x80557fe <has_inp_out+18>: mov 0x18(%edx),%eax 0x8055801 <has_inp_out+21>: cmp %eax,%ebx 0x8055803 <has_inp_out+23>: jae 0x805582f <has_inp_out+67> 0x8055805 <has_inp_out+25>: mov 0x1c(%edx),%edx 0x8055808 <has_inp_out+28>: mov %edx,0xfffffffc(%ebp) 0x805580b <has_inp_out+31>: mov %eax,%edi 0x805580d <has_inp_out+33>: lea 0x0(%esi),%esi 0x8055810 <has_inp_out+36>: mov 0xfffffffc(%ebp),%eax 0x8055813 <has_inp_out+39>: mov (%eax,%ecx,4),%edx 0x8055816 <has_inp_out+42>: mov %edx,%eax 0x8055818 <has_inp_out+44>: and $0x9,%eax 0x805581b <has_inp_out+47>: cmp $0x9,%eax 0x805581e <has_inp_out+50>: jne 0x8055821 <has_inp_out+53> 0x8055820 <has_inp_out+52>: inc %esi 0x8055821 <has_inp_out+53>: and $0xa,%edx 0x8055824 <has_inp_out+56>: cmp $0xa,%edx 0x8055827 <has_inp_out+59>: jne 0x805582a <has_inp_out+62> 0x8055829 <has_inp_out+61>: inc %ebx 0x805582a <has_inp_out+62>: inc %ecx 0x805582b <has_inp_out+63>: cmp %edi,%ecx 0x805582d <has_inp_out+65>: jb 0x8055810 <has_inp_out+36> 0x805582f <has_inp_out+67>: cmp 0xc(%ebp),%esi 0x8055832 <has_inp_out+70>: jne 0x8055840 <has_inp_out+84> 0x8055834 <has_inp_out+72>: cmp 0x10(%ebp),%ebx 0x8055837 <has_inp_out+75>: jne 0x8055840 <has_inp_out+84> 0x8055839 <has_inp_out+77>: mov $0x1,%eax 0x805583e <has_inp_out+82>: jmp 0x8055842 <has_inp_out+86> 0x8055840 <has_inp_out+84>: xor %eax,%eax 0x8055842 <has_inp_out+86>: pop %ebx 0x8055843 <has_inp_out+87>: pop %esi 0x8055844 <has_inp_out+88>: pop %edi 0x8055845 <has_inp_out+89>: leave ---Type <return> to continue, or q <return> to quit--- 0x8055846 <has_inp_out+90>: ret End of assembler dump. >How-To-Repeat: >Fix: I'm no good with assembler. >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2001-06-27 8:26 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-27 8:26 apwingo [this message] 2001-07-20 15:14 jsm28 2001-10-29 10:29 rodrigc
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=20010627151904.32184.qmail@sourceware.cygnus.com \ --to=apwingo@eos.ncsu.edu \ --cc=gcc-gnats@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: 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).