public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/3440: pointer to a struct changes when no assignment has been made to it
@ 2001-10-29 10:29 rodrigc
  0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2001-10-29 10:29 UTC (permalink / raw)
  To: apwingo, gcc-bugs, gcc-prs, jsm28, nobody

Synopsis: pointer to a struct changes when no assignment has been made to it

State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Mon Oct 29 10:29:56 2001
State-Changed-Why:
    No preprocessed source provided.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3440&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c/3440: pointer to a struct changes when no assignment has been made to it
@ 2001-07-20 15:14 jsm28
  0 siblings, 0 replies; 3+ messages in thread
From: jsm28 @ 2001-07-20 15:14 UTC (permalink / raw)
  To: apwingo, gcc-bugs, gcc-prs, jsm28, nobody

Synopsis: pointer to a struct changes when no assignment has been made to it

State-Changed-From-To: open->feedback
State-Changed-By: jsm28
State-Changed-When: Fri Jul 20 15:14:06 2001
State-Changed-Why:
    You don't include complete preprocessed source.  A code
    extract is not enough unless it is self-contained and can
    be passed to the compiler by itself; your fragment isn't,
    e.g. gboolean not declared.  Please provide self-contained
    preprocessed source (send it to gcc-gnats@gcc.gnu.org, keeping
    the subject of this message).

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3440&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* c/3440: pointer to a struct changes when no assignment has been made to it
@ 2001-06-27  8:26 apwingo
  0 siblings, 0 replies; 3+ messages in thread
From: apwingo @ 2001-06-27  8:26 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-10-29 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-29 10:29 c/3440: pointer to a struct changes when no assignment has been made to it rodrigc
  -- strict thread matches above, loose matches on Subject: below --
2001-07-20 15:14 jsm28
2001-06-27  8:26 apwingo

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).