Skip to content

-Watomic-alignment too eager? #37941

@glandium

Description

@glandium
Bugzilla Link 38593
Version unspecified
OS Linux
CC @DimitryAndric,@froydnj

Extended Description

$ cat <<EOF > test.c
#include <stdint.h>

uint64_t
loadSeqCst(uint64_t* addr) {
  uint64_t v;
  __atomic_load(addr, &v, __ATOMIC_SEQ_CST);
  return v;
}
EOF
$ clang-7 -o test.o -c test.c -m32
test.c:6:3: warning: misaligned or large atomic operation may incur significant performance penalty [-Watomic-alignment]
  __atomic_load(addr, &v, __ATOMIC_SEQ_CST);
  ^
1 warning generated.

This seems too eager for a warning that is emitted without even passing a -Wsomething on the command line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions