Date: Sat, 12 Oct 1996 10:21:36 +0200 From: Poul-Henning Kamp <phk@critter.tfs.com> To: "Philippe Charnier" <charnier@xp11.frmug.org> Cc: current@FreeBSD.org Subject: Re: gcc's bug. please comment Message-ID: <3203.845108496@critter.tfs.com> In-Reply-To: Your message of "Fri, 11 Oct 1996 21:05:36 %2B0200." <199610111905.VAA01615@xp11.frmug.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199610111905.VAA01615@xp11.frmug.org>, "Philippe Charnier" writes: >Hello, > >A friend found a bug in gcc-2.7.2.1. The following program fails on >i386 architecture (both FreeBSD and solaris-x86) and works as expected >on sparc (both sunos and solaris2.5.1) and on hp (hp-ux9.07). As I'm >not on the gcc-bug list, please comment before I report the bug. This >afternoon I sent a bug report to Sun but it was before trying on >FreeBSD. > >The output should be `1 2' but it is `2 1' on i386 computers. >Here is the code: > >----------mypb2.c----------------- >#include <stdio.h> >#include <stdlib.h> > >main() >{ FILE *fic; > int a[2][50], i = 0; > > fic=fopen("mypb2.csv","r"); > fscanf(fic, "%d;%d", &a[1][i++], &a[1][i++]); The order in which the i++'s get evaluated is not defined by the apocryphical writings, thus the behavior of this line is likely to depend on the parameter passing convention of the CPU. -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@ref.tfs.com TRW Financial Systems, Inc. Future will arrive by its own means, progress not so.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3203.845108496>