This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: document inconsistant?
- To: Joe Buck <jbuck at racerx dot synopsys dot com>
- Subject: Re: document inconsistant?
- From: Min Xu <mxu at cae dot wisc dot edu>
- Date: Thu, 30 Mar 2000 17:33:23 -0600
- CC: gcc at gcc dot gnu dot org
- References: <200003302319.PAA13297@racerx.synopsys.com>
- Reply-To: mxu at cae dot wisc dot edu
Joe Buck wrote:
> This behavior is normal when you have a program that accesses uninitialized
> memory. The values you get will be semi-random, depending on the detailed
> layout of the code. While it is remotely possible that you've detected
> a compiler problem, in 99.9%+ of cases of this kind, the bug is in your
> program.
>
> Another possibility is that you have code that relies on the order of
> side effects, like
>
> bar = foo(i++, i++);
>
> The order in which arguments to functions get evaluated is not defined in
> C/C++ and can be chosen by the optimizer to be whatever is convenient.
>
> gcc may be able to detect *some* problems in your code if you add the -Wall
> switch, but lack of -Wall warnings is not a guarantee that you haven't
> made a mistake of this kind.
Thanks for your suggestion, but as I said, one question is that I notice my
problem is not that *random*, but related to what options I give to the
compiler.
As to the side effect you mentioned, I am sure that when I was calling the
function
I didn't do anything like ++ or --, and the problematic function call contains
only int and double parameters, no pointers at all. And the actual values I
given
was also matching the declaration, so there was no int<->double cast.
And I even tried -pedatic and -Wall options before, no important warnings can
get from it.