public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: Value not equal to itself
  2012-05-27  4:31 Value not equal to itself Jordan Foster
@ 2012-05-27  4:31 ` Jordan Foster
  2012-05-27 10:22 ` Andrew Pinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jordan Foster @ 2012-05-27  4:31 UTC (permalink / raw)
  To: gcc-bugs

On 5/26/12, Jordan Foster <jrdnfstr92@gmail.com> wrote:
> gcc -v; gcc version 4.2.1 20070831 patched [FreeBSD]
> uname -srip; FreeBSD 9.0-RELEASE i386 GENERI
> Compiler command; gcc47 minimalErroringCode.cpp -o minimalErroringCode
> Test; ./minimalErroringCode
> Expected; no output
> Result; Assertion failed: ((buffer[0] = 0xFF) && buffer[0] == 0xFF),
> function main, file minimalErroringCode.cpp, line 4.
>
Sorry my bad, sign problem


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Value not equal to itself
@ 2012-05-27  4:31 Jordan Foster
  2012-05-27  4:31 ` Jordan Foster
  2012-05-27 10:22 ` Andrew Pinski
  0 siblings, 2 replies; 3+ messages in thread
From: Jordan Foster @ 2012-05-27  4:31 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

gcc -v; gcc version 4.2.1 20070831 patched [FreeBSD]
uname -srip; FreeBSD 9.0-RELEASE i386 GENERI
Compiler command; gcc47 minimalErroringCode.cpp -o minimalErroringCode
Test; ./minimalErroringCode
Expected; no output
Result; Assertion failed: ((buffer[0] = 0xFF) && buffer[0] == 0xFF),
function main, file minimalErroringCode.cpp, line 4.

[-- Attachment #2: minimalErroringCode.cpp --]
[-- Type: text/x-c++src, Size: 118 bytes --]

#include <cassert>
int main() {
  char buffer[1024];
  assert((buffer[0] = 0xFF) && buffer[0] == 0xFF);
  return 0;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Value not equal to itself
  2012-05-27  4:31 Value not equal to itself Jordan Foster
  2012-05-27  4:31 ` Jordan Foster
@ 2012-05-27 10:22 ` Andrew Pinski
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2012-05-27 10:22 UTC (permalink / raw)
  To: Jordan Foster; +Cc: gcc-bugs

On Sat, May 26, 2012 at 8:25 PM, Jordan Foster <jrdnfstr92@gmail.com> wrote:
> gcc -v; gcc version 4.2.1 20070831 patched [FreeBSD]
> uname -srip; FreeBSD 9.0-RELEASE i386 GENERI
> Compiler command; gcc47 minimalErroringCode.cpp -o minimalErroringCode
> Test; ./minimalErroringCode
> Expected; no output
> Result; Assertion failed: ((buffer[0] = 0xFF) && buffer[0] == 0xFF),
> function main, file minimalErroringCode.cpp, line 4.

Easy answer buffer[0] when promoted to int because of the rules of
C/C++, is equal to -1 and not 255.  So a signed char will never equal
to 0xff.

Thanks,
Andrew Pinski


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-27  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-27  4:31 Value not equal to itself Jordan Foster
2012-05-27  4:31 ` Jordan Foster
2012-05-27 10:22 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).