public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40693]  New: atomic built-ins malfunction with 64-bit and optimization
@ 2009-07-08 23:10 m dot rosellini at f5 dot com
  2009-07-09  0:10 ` [Bug c/40693] " m dot rosellini at f5 dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: m dot rosellini at f5 dot com @ 2009-07-08 23:10 UTC (permalink / raw)
  To: gcc-bugs

#include <stdint.h>
#include <stdio.h>

int
main(int ac, char *av[])
{
    int64_t x;
    int64_t like_a_constant = -1;
    int64_t unlike_a_constant = -1;

    if (ac == 0) unlike_a_constant = 5;

    x = 0;
    __sync_add_and_fetch(&x, like_a_constant);
    printf("%016llx\n", x);

    x = 0;
    __sync_add_and_fetch(&x, unlike_a_constant);
    printf("%016llx\n", x);
}

Expected result:
ffffffffffffffff
ffffffffffffffff

Actual result:
00000000ffffffff
ffffffffffffffff


-- 
           Summary: atomic built-ins malfunction with 64-bit and
                    optimization
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: m dot rosellini at f5 dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40693


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

end of thread, other threads:[~2009-10-14  4:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08 23:10 [Bug c/40693] New: atomic built-ins malfunction with 64-bit and optimization m dot rosellini at f5 dot com
2009-07-09  0:10 ` [Bug c/40693] " m dot rosellini at f5 dot com
2009-07-09  5:54 ` [Bug target/40693] atomic built-ins malfunction with 64-bit signed ptrs and negative constants jakub at gcc dot gnu dot org
2009-07-09 20:29 ` m dot rosellini at f5 dot com
2009-10-14  4:00 ` pinskia at gcc dot gnu dot org

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).