This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67433] ?: expression returns unexpected value when condition is a bool variable which memory is not true/false
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 Sep 2015 08:22:49 +0000
- Subject: [Bug c/67433] ?: expression returns unexpected value when condition is a bool variable which memory is not true/false
- Auto-submitted: auto-generated
- References: <bug-67433-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to xuejuncao from comment #4)
> btw, the same code works fine on Mac:
>
> $gcc --version
> Configured with: --prefix=/Library/Developer/CommandLineTools/usr
> --with-gxx-include-dir=/usr/include/c++/4.2.1
> Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
> Target: x86_64-apple-darwin14.5.0
> Thread model: posix
So this is undefined behavior.