[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

Lin Yurong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 07:23:11 PDT 2022


yronglin added a comment.

Reproduce windows broken test:

ignore.cpp

  #include <stddef.h>
  
  void *__builtin_assume_aligned(const void *, size_t, ...) noexcept;
  void foo() {
    int a;
    (void) __builtin_assume_aligned(&a, 4);
  }



  FunctionDecl 0x14a80e480 <./ignore.cpp:3:1, col:7> col:7 __builtin_assume_aligned 'void *(const void *, size_t, ...) noexcept'
  |-ParmVarDecl 0x14a80df80 <col:32, col:43> col:44 'const void *'
  `-ParmVarDecl 0x14a80e050 <col:46> col:52 'size_t':'unsigned long'
  FunctionDecl 0x14a80e210 <./ignore.cpp:3:7> col:7 implicit __builtin_assume_aligned 'void *(const void *, unsigned long, ...) noexcept' extern
  |-ParmVarDecl 0x14a80e308 <<invalid sloc>> <invalid sloc> 'const void *'
  |-ParmVarDecl 0x14a80e370 <<invalid sloc>> <invalid sloc> 'unsigned long'
  |-BuiltinAttr 0x14a80e2b0 <<invalid sloc>> Implicit 402
  |-NoThrowAttr 0x14a80e3e8 <col:7> Implicit
  `-ConstAttr 0x14a80e410 <col:7> Implicit

  ./ignore.cpp:3:7: error: cannot redeclare builtin function '__builtin_assume_aligned'
  void *__builtin_assume_aligned(const void *, size_t, ...) noexcept;
        ^
  ./ignore.cpp:3:7: note: '__builtin_assume_aligned' is a builtin with type 'void *(const void *, unsigned long, ...) noexcept'
  1 error generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133202/new/

https://reviews.llvm.org/D133202



More information about the cfe-commits mailing list