This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for various warnings in gcc
> From: Gabriel Dos Reis <gdr@integrable-solutions.net>
>
> "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
> |
> | But it still compiled right?
> |
> | I tried cc on irix6.2 and solaris2 and it worked.
>
> I'm not sure how I should interpret "it worked". The above construct
> strictly speaking invokes an undefined behaviour. So in the least
> damaging mode, it might return any random value.
My code example tested whether the construct "int a = a;" by itself
causes a compiler to choke. So by "worked" I meant it "compiled".
The behavior of the code wasn't the issue since in theory you would
have a convoluted code path which actually sets the variable properly
before returning `a'.
Let's not get into a discussion about "undefined" behavior can format
your hard drive please. :-)
--
Kaveh R. Ghazi Director of Systems Architecture
ghazi@caip.rutgers.edu Qwest Solutions