[wplug] Linux vs OS X version of GCC
Jonathan S. Billings
billings at negate.org
Thu Apr 20 08:29:40 EDT 2006
Bill Moran wrote:
> A number of things are possible here:
> 1) One or the other versions of GCC is buggy.
In both cases, gcc with all warnings turned on says:
"warning: operation on `t' may be undefined" (in my code), so basically,
I wouldn't expect the behavior to be consistant between versions of gcc
and architectures. I don't think it could be considered a bug.
> 2) The Mac version has been patched, and doesn't exactly match the GCC
> version in it's behaviour.
There are a bunch of Altivec-specific patches I think (at least, on my
mac) but I don't think it makes much of a difference here.
> 3) Have you checked to see what -O level is being used on each system?
> It's fairly well known that higher -O levels are likely to generate
> broken code.
I ran all my tests on my linux and mac with gcc -O0 -Wall.
Another data point: I tried my test code using Sun's SUNWspro compiler
on a test solaris 8 system, and got this:
> ./test.SUNWspro.solaris8
Initial array:
[0][0] == a
[0][1] == aa
[1][0] == aaa
[1][1] == aaaa
Testing increment when getting the value:
[t++][strlen(test[t])] == a (t starts off as 0, ends up as 1)
[t][strlen(test[t++])] == aaa (t starts off as 0, ends up as 1)
I think we can safely say that the behavior is not going to be
consistant, and that each compiler and architecture is going to behave
differently.
--
Jonathan Billings <billings at negate.org>
More information about the wplug
mailing list