This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/5351: function pass-by-value structure copy corrupts structure on stack


Synopsis: function pass-by-value structure copy corrupts structure on stack

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Nov  5 08:05:52 2002
State-Changed-Why:
    I can reproduce this with 3.2.1pre, but it seems fixed in
    present CVS. However, since this is a regression w.r.t.
    2.95, I leave it open and put it into "high". A reduced
    testcase is this:
    ----------------------------------
    #include <stdio.h>
    #include <string.h>
    
    struct X {
            char s[100];
    };
    
    void foo(struct X x) {
      printf("x.s: %s\n", x.s);
    }
    
    int main() {
        struct X x;
        strcpy(x.s, "this is a test string");
        foo(x);
    }
    -------------------------------------
    With 3.2.1pre I get
    tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/gcc x.c
    tmp/g> ./a.out
    x.s: Äñÿ¿Ôa@st string
    
    This is not what I want to see.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]