This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/68868] atomic_init emits an unnecessary fence


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68868

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-12-14
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.2, 5.1.0, 6.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Unfortunately, the simple patch in the Description doesn't work for char
literals.  I.e., this 

  atomic_char a;
  atomic_init (a, 'x');

doesn't compile because __typeof__ ('x') is int and calling __atomic_store with
pointers to types of mismatching size produces:

  error: size mismatch in argument 2 of â__atomic_storeâ
     atomic_init (a, 'x');
     ^

This is likely why Clang implements atomic_init in terms of its
__c11_atomic_init intrinsic.

Assigning to self to come up with a better patch.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]