Skip to content

__BIGGEST_ALIGNMENT__ not the same as gcc for AVX and later #41899

@llvmbot

Description

@llvmbot
Bugzilla Link 42554
Version 8.0
OS Linux
Reporter LLVM Bugzilla Contributor
CC @topperc,@DougGregor,@RKSimon,@zygoloid

Extended Description

When compiled -march=native (on znver1) with gcc and clang I get the following:

  • gcc 9.1.1 20190503 (Red Hat 9.1.1-1)
    alignof(max_align_t)=16  __BIGGEST_ALIGNMENT__=32  malloc() align=16
    __SSE__  __AVX__  __AVX2__
  • clang 8.0.0 (Fedora 8.0.0-1.fc30)
    (4.2.1 Compatible Clang 8.0.0 (Fedora 8.0.0-1.fc30))
   alignof(max_align_t)=16  __BIGGEST_ALIGNMENT__=16  malloc() align=16
   __SSE__  __AVX__  __AVX2__

When compiled without -march=native, both give:

   alignof(max_align_t)=16  __BIGGEST_ALIGNMENT__=16  malloc() align=16
   __SSE__

My guess is that clang's __BIGGEST_ALIGNMENT__ for -march=native is a bug... except that gcc v4.2.1 predates AVX ???

FWIW: in all cases glibc malloc() aligned to 16. My reading of the glibc code tells me that its alignment is 2*sizeof(size_t), which is in fact the same as alignof(max_align_t), but is in no way related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary InterfacebugzillaIssues migrated from bugzillacclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions