Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • BIND BIND
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 569
    • Issues 569
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 112
    • Merge requests 112
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • BINDBIND
  • Issues
  • #2601
Closed
Open
Issue created Mar 26, 2021 by Roland Illig@rillig

typo in definition of atomic_exchange_explicit for Clang on Unix

Summary

stdatomic.h says:

#define atomic_exchange_explicit(obj, desired, order) \
	__c11_atomic_exchange_explicit(obj, expected, order)

This only works if the second argument to that macro is the identifier 'expected'. Otherwise this (hopefully) produces a 'no such local variable' message from the compiler.

Steps to reproduce

Compile queue.c with compiler options that trigger the faulty macro.

The original code in queue.c is:

    item = atomic_exchange(&(lh->items[idx]),
                           (uintptr_t)&queue->taken);

This produces the following line after preprocessing:

  item = __c11_atomic_exchange_explicit(&(lh->items[idx]), expected, memory_order_seq_cst);

This line does not contain queue->taken anymore.

What is the current bug behavior?

Compilation fails because expected is not a defined variable.

What is the expected correct behavior?

Compilation succeeds.

Possible fixes

Write 'desired' instead of 'expected'.

Edited Mar 27, 2021 by Roland Illig
Assignee
Assign to
Time tracking