IRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: xuejuncao at gmail dot com
Target Milestone: ---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
xuejuncao changed:
What|Removed |Added
Summary|?: expresion returns|?: expression returns
|une
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #3 from xuejuncao ---
(In reply to Andrew Pinski from comment #2)
> Bool can only be 0 or 1, any other value causes undefined behavior.
but it seems like a trap, the below code will not work fine, and will make
program abort.
(expect
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #4 from xuejuncao ---
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) (bas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #8 from xuejuncao ---
thanks, i get the below result with -fsanitize=undefined
boolmagic.c:12:16: runtime error: load of value 255, which is not a valid value
for type '_Bool'
boolmagic.c:13:15: runtime error: load of value 255, whi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #10 from xuejuncao ---
when bool value read from unpacked stream or file, wen can not ensure it's 1 or
0;
so maybe the best solution is compile with "-D_Bool=char" for now :-/
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67433
--- Comment #12 from xuejuncao ---
(In reply to Richard Biener from comment #11)
> (In reply to xuejuncao from comment #10)
> > when bool value read from unpacked stream or file, wen can not ensure it's 1
> > or 0;
> > so maybe the best solution