[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2016-01-19 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #8 from joseph at codesourcery dot com --- I think we should keep the built-in function semantics as-is, and fix stdatomic.h along the lines I proposed in comment#3.

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2016-01-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org Known to f

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #6 from Jonathan Wakely --- (In reply to Richard Smith from comment #2) > libstdc++ uses these builtins in bits/atomic_base.h: > > __pointer_type > fetch_add(ptrdiff_t __d, > memory_order __m = memory_orde

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread richard-gccbugzilla at metafoo dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #5 from Richard Smith --- (In reply to jos...@codesourcery.com from comment #3) > The first question is whether this code is actually valid. To my reading, the C11 standard says that these operations must work on all atomic integer t

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #4 from joseph at codesourcery dot com --- (And this shows an admission from the tests - a new gcc.dg/atomic/stdatomic-op-*.c test should be added that tests _add and _sub for pointer types.)

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #3 from joseph at codesourcery dot com --- The first question is whether this code is actually valid. C11 says "All of these operations are applicable to an object of any atomic integer type.", not mentioning pointer types as valid

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread richard-gccbugzilla at metafoo dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 --- Comment #2 from Richard Smith --- libstdc++ uses these builtins in bits/atomic_base.h: __pointer_type fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) noexcept { return __atomic_fetch_add(&_

[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type

2015-01-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843 Richard Biener changed: What|Removed |Added Keywords||documentation, wrong-code S