http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
Summary: Code produces two different outputs when optimized
respectively with -O2 and without it.
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: major
P
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
--- Comment #2 from Danilo 2010-10-20 14:07:45 UTC
---
(In reply to comment #1)
> There is no memory synchronisation, so there is no guarantee that the write to
> alpha1->number ever becomes visible to other threads.
According to http://wiki.lib
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
Danilo changed:
What|Removed |Added
Status|RESOLVED|UNCONFIRMED
Resolution|INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
--- Comment #9 from Danilo 2010-10-20 14:43:18 UTC
---
(In reply to comment #7)
> > Using a mutex around the reads and writes of shared data will make it work
> > as
> > expected, the compiler won't optimise away the read and will re-read the
>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
Danilo changed:
What|Removed |Added
Status|RESOLVED|CLOSED
--- Comment #10 from Danilo 2010-10-20 1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
--- Comment #12 from Danilo 2010-10-20 16:53:53 UTC
---
(In reply to comment #11)
> Busy waiting is rarely a good idea, so it depends on what are you exactly
> waiting for and whether say pthread_barrier_wait, or mutex, or condvar etc.
> wouldn't
signedTo: unassigned at gcc dot gnu dot org
ReportedBy: zweifel at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36175