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]

[Bug c/17018] New: address increment of function parameters changes their order


gcc -v reports:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /netrel/src/gcc-3.3.1-2/configure --enable-languages=c,c++,f77,
java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --wi
thout-included-gettext --enable-interpreter --enable-sjlj-exceptions --disable-v
ersion-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-p
c-cygwin --target=i686-pc-cygwin --prefix=/usr --exec-prefix=/usr --sysconfdir=/
etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin
Thread model: posix
gcc version 3.3.1 (cygming special)

The program is:

#include <stdio.h>

void foo( char c1, char c2, char c3 ) {
  printf( "%c%c%c\n", c1, c2, c3 );
}

int main( int argc, char **argv ) {
  int i = 0;
  char a[] = "abc";
  char *pc = a;
  foo( a[i++], a[i++], a[i++] );
  foo( *pc++, *pc++, *pc++ );
  i = 0;
  pc = a;
  foo( a[i++], a[i++], a[i] );
  foo( *pc++, *pc++, *pc );
  return 0;
}

The output is:
cba
cba
baa
baa

When I would expect (and I got with gcc 2.95.2 under Solaris 9!):
abc
abc
abc
abc

-- 
           Summary: address increment of function parameters changes their
                    order
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: svetozarmarkov at netscape dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17018


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